From 78ba495a2faafafe2e39b8c4e7431d894ffb9b74 Mon Sep 17 00:00:00 2001 From: setop Date: Wed, 18 Sep 2024 11:58:42 +0200 Subject: [PATCH] improve catalog - add entrie - add a linter - lint catalog --- README.md | 1 + TODO.md | 5 ++ catalog.off.yaml | 38 +++++++++ catalog.yaml | 204 +++++++++++++++++++++++++++++++++-------------- lint.py | 81 +++++++++++++++++++ 5 files changed, 269 insertions(+), 60 deletions(-) create mode 100644 catalog.off.yaml create mode 100644 lint.py diff --git a/README.md b/README.md index 9b26698..4d484f8 100644 --- a/README.md +++ b/README.md @@ -134,4 +134,5 @@ Currently only Linux is supported. It should work on all Unix like OS. For other * [nvchecker](https://github.com/kdabir/has), for checking if a new version of some software has been released. * [fig/autocomplete](https://github.com/withfig/autocomplete), contributed completion for hundreds of CLI * this[article](https://exple.tive.org/blarg/2023/02/17/modern-problems-require-modern-solutions/) +* [eget](gh:zyedidia/eget) ; similar, but no defaults, all is configuration diff --git a/TODO.md b/TODO.md index b6cce3b..11377a8 100644 --- a/TODO.md +++ b/TODO.md @@ -51,6 +51,11 @@ - [ ] existence of `.local`, `.local/programs`, `.local/bin` - [ ] that permissions are ok - [ ] that `.local/bin` are in `PATH` + - [ ] a linter for the catalog + - [x] rules: entries sorted, check for required field, common mistakes (tag/tags), repo is existing, etc. + - [ ] may use a schema instead of hard coded rules + - [ ] have a nicer output, with some colors, see what pytest can do + - [ ] add an option to fix - [ ] UI, add some progress to install (steps : 1/5 check current version, 2/5 ..) - [ ] allow to list versions - [ ] allow to force installation of a given version diff --git a/catalog.off.yaml b/catalog.off.yaml new file mode 100644 index 0000000..fce3c08 --- /dev/null +++ b/catalog.off.yaml @@ -0,0 +1,38 @@ +# here we put all what is not really CLI or what is too obvious +# including but not restricted to : shell, shell related, version control systems + +fish: + name: fishell + website: https://fishshell.com/ + desc: a smart and user-friendly command line shell + +fossil: + website: https://fossil-scm.org/ + desc: simple, high-reliability, distributed SCM system + +git: + desc: distributed SCM + +nushell: + website: https://www.nushell.sh/ + desc: A new type of shell + +pijul: + website: https://pijul.org/ + desc: distributed SCM + +screen: + desc: venerable multiplexer + +starship: + website: https://starship.rs/ + desc: minimal, blazing-fast, and infinitely customizable prompt for any shell + +tmux: + desc: terminal multiplexer + github: tmux/tmux + + +zellij: + website: https://zellij.dev + desc: Zellij is a terminal workspace. It has the base functionality of a terminal multiplexer (similar to tmux or screen) but includes many built-in features that would allow users to extend it and create their own personalized environment. diff --git a/catalog.yaml b/catalog.yaml index 8c9d261..7a8d800 100644 --- a/catalog.yaml +++ b/catalog.yaml @@ -1,8 +1,14 @@ ab: - fullname: Apache Benchmark + name: Apache Benchmark desc: a tool for benchmarking your Apache Hypertext Transfer Protocol (HTTP) server website: https://httpd.apache.org/docs/2.4/programs/ab.html +ag: + name: the silver searcher + github: ggreer/the_silver_searcher + desc: A code-searching tool similar to ack, but faster. + website: https://geoff.greer.fm/ag/ + amber: website: https://amber-lang.com/ desc: a programming language transpiled into Bash Script @@ -17,16 +23,17 @@ aria2: desc: lightweight multi-protocol & multi-source command-line download utility github: aria2/aria2 -asdf: - desc: manage developement environments for many languages with multiple concurrent versions - github: asdf-vm/asdf - asciinema: desc: Record and share your terminal sessions website: https://asciinema.org/ pip: +asdf: + desc: manage developement environments for many languages with multiple concurrent versions + github: asdf-vm/asdf + atuin: + website: https://atuin.sh/ desc: Magical shell history github: ellie/atuin @@ -43,21 +50,26 @@ benthos: website: https://www.benthos.dev/ github: benthosdev/benthos -bottom: - desc: A customizable cross-platform graphical process/system monitor for the terminal - github: ClementTsang/bottom - -br: - fullname: Broot - desc: Get an overview of a directory, even a big one - github: Canop/broot - bfs: desc: A breadth-first version of the UNIX find command website: https://tavianator.com/projects/bfs.html github: tavianator/bfs tags: C, find +bottom: + desc: A customizable cross-platform graphical process/system monitor for the terminal + github: ClementTsang/bottom + +br: + name: Broot + desc: Get an overview of a directory, even a big one + github: Canop/broot + +btop: + github: aristocratos/btop + desc: A monitor of resources + tags: cpp + chezmoi: desc: Manage your dotfiles across multiple diverse machines, securely github: twpayne/chezmoi @@ -70,12 +82,23 @@ cliget: desc: install various tools in your user profile #github: setop/cliget +curl: + github: curl/curl + website: https://curl.se/ + desc: transferring data with URL syntax + d2: - fullname: Declarative Diagramming + name: Declarative Diagramming desc: a diagram scripting language that turns text to diagrams website: https://d2-lang.com/ github: terrastruct/d2 +delta: + desc: A syntax-highlighting pager for git, diff, grep, and blame output + name: git-delta + cargo: git-delta + github: dandavison/delta + diagram: desc: CLI app to convert ASCII arts into hand drawn diagrams github: esimov/diagram @@ -108,13 +131,17 @@ dua: duf: desc: Disk Usage/Free Utility - a better 'df' alternative github: muesli/duf - + +exa: + desc: modern replacement for ‘ls’ ; unmaintaned, prefer eza + github: ogham/exa + eza: desc: enhanced ls (active clone of exa) github: eza-community/eza fail: - desc: this entry will fail, for test purpos + desc: this entry will fail, for test purpose github: fail/fail fd: @@ -172,6 +199,12 @@ glow: gotty: desc: Share your terminal as a web application +grex: + github: pemistahl/grex + desc: build regular expressions from samples + website: https://pemistahl.github.io/grex-js/ + cargo: + gron: desc: flatter json to make it greppable github: tomnomnom/gron @@ -207,14 +240,20 @@ hurl: desc: run HTTP requests defined in a simple plain text format github: Orange-OpenSource/hurl website: https://hurl.dev/ + tags: curl hx: - fullname: helix + name: helix desc: text editor, inspired by vim +hyperfine: + github: sharkdp/hyperfine + desc: benchmarking tool + tags: rust + ijq: desc: interactive jq tool. Like jqplay for the commandline - repo: https://sr.ht/~gpanders/ijq/ + srht: gpanders/ijq website: https://gpanders.com/blog/making-ijq-fast tags: Go @@ -228,11 +267,16 @@ jc: github: kellyjonbrazil/jc pip: jc +jd: + desc: JSON diff and patch + github: josephburnett/jd + jinja2: desc: CLI for Jinja2 github: mattrobenolt/jinja2-cli jj: + name: Jujutsu desc: A Git-compatible DVCS that is both simple and powerful github: martinvonz/jj tags: rust @@ -291,13 +335,24 @@ litestream: lnav: desc: An advanced log file viewer for the small-scale - fullname: The Logfile Navigator + name: The Logfile Navigator website: https://lnav.org/ github: tstack/lnav +lsd: + desc: next gen ls command + github: lsd-rs/lsd + cargo: + tags: rust + mc: desc: minio client - versions: # see https://github.com/penpyt/asdf-mc/raw/master/bin/list-all + # versions, see https://github.com/penpyt/asdf-mc/raw/master/bin/list-all + +micro: + github: zyedidia/micro + desc: a modern and intuitive terminal-based text editor + tags: Go, tui minify: desc: minifiers for web formats @@ -318,6 +373,7 @@ minijinja: mintotp: desc: generate TOTP from the terminal + github: susam/mintotp mintproxy: desc: interactive, SSL/TLS-capable intercepting proxy with a console interface for HTTP/1, HTTP/2, and WebSockets. @@ -325,7 +381,7 @@ mintproxy: mlr: desc: Miller is like awk, sed, cut, join, and sort for name-indexed data such as CSV, TSV, and tabular JSON - fullname: miller + name: miller github: johnkerl/miller mosh: @@ -369,17 +425,22 @@ pet: desc: Simple command-line snippet manager github: knqyf263/pet +pueue: + github: Nukesor/pueue + desc: processes a queue of shell commands + tags: Rust + pup: desc: Parsing HTML at the command line github: ericchiang/pup pylufic: - inst: direct + pip: desc: Let's upload that file CLI qjs: desc: a small and embeddable Javascript engine. - fullname: QuiskJS + name: QuiskJS website: https://bellard.org/quickjs/ qr: @@ -396,22 +457,22 @@ redo: github: barthr/redo relpipe: - fullname: Relational pipes + name: Relational pipes website: https://relational-pipes.globalcode.info/ desc: Relational pipes are an open data format designed for streaming structured data between two processes. tags: text-processing +rg: + name: ripgrep + desc: improved grep + github: BurntSushi/ripgrep + rlwrap: desc: A readline wrapper, with history and completion github: hanslub42/rlwrap -rg: - fullname: ripgrep - desc: improved grep - github: BurntSushi/ripgrep - rq: - fullname: Record Query + name: Record Query desc: A tool for doing format transformation. Supports Avro, CBOR, JSON, MessagePack, Protocol Buffers, YAML, TOML, CSV github: dflemstr/rq @@ -420,6 +481,15 @@ sake: github: alajmo/sake website: https://sakecli.com/ +scc: + github: boyter/scc + desc: "Sloc, Cloc and Code: scc is a very fast accurate code counter with complexity calculations and COCOMO estimates" + tags: Go + +sd: + github: chmln/sd + desc: intuitive find & replace CLI (sed alternative) + semgrep: desc: Lightweight static analysis for many languages. Find bug variants with patterns that look like source code. website: https://semgrep.dev/ @@ -432,26 +502,26 @@ semgrepx: tags: Go sg: - fullname: ast-grep + name: ast-grep desc: fast and polyglot tool for code structural search, lint, rewriting at large scale github: ast-grep/ast-grep website: https://ast-grep.github.io/ tags: rust +sk: + name: skim + desc: general fuzzy finder ; like fzf + github: lotabout/skim + cargo: skim + tags: rust + slugify: desc: generate sluged version of input github: un33k/python-slugify slurp: desc: put whole input in memory before processing ; this allow to overrite input file ; like `sed -i` ; prefer `sponge` from moreutils package - shell: cat > /dev/shm/slurp_$$ && cat /dev/shm/slurp_$$ ; rm /dev/shm/slurp_$$ - -sk: - fullname: skim - desc: general fuzzy finder - github: lotabout/skim - cargo: skim - tags: rust + # shell: cat > /dev/shm/slurp_$$ && cat /dev/shm/slurp_$$ ; rm /dev/shm/slurp_$$ so: desc: A terminal interface for Stack Overflow @@ -481,26 +551,27 @@ teip: desc: Highly efficient "Masking tape" for Shell github: greymd/teip -terminews: - desc: RSS client in the terminal - github: antavelos/terminews - termdbms: desc: A TUI for viewing and editing database files, CSV and SQLite. github: mathaou/termdbms +terminews: + desc: RSS client in the terminal + github: antavelos/terminews + #tldr: # desc: Collaborative cheatsheets for console commands ; must choose a client # website: https://tldr.sh/ -tmux: - desc: terminal multiplexer - github: tmux/tmux - tqdm: desc: a better pv pip: +tre: + desc: a better tree + github: dduan/tre + tags: Rust + trivy: desc: Find vulnerabilities, misconfigurations, secrets, SBOM in containers, Kubernetes, code repositories, clouds and more github: aquasecurity/trivy @@ -509,10 +580,9 @@ ttyd: desc: share terminal over the web github: tsl0922/ttyd -up: - desc: interactively edit pipe - fullname: Ultimate Plumber - github: akavel/up +typst: + website: https://typst.app/ + desc: A new markup-based typesetting system that is powerful and easy to learn. ugrep: desc: a more powerful, ultra fast, user-friendly, compatible grep @@ -520,13 +590,19 @@ ugrep: website: https://ugrep.com/ tags: cpp +up: + desc: interactively edit pipe + name: Ultimate Plumber + github: akavel/up + ups: desc: Command line tools for manipulating UPS patch files - githb: rameshvarun/ups + github: rameshvarun/ups tags: go vd: - fullname: VisiData + name: VisiData + website: https://www.visidata.org/ desc: interactive multitool for tabular data pip: visidata,lxml,odfpy,openpyxl,pyarrow,urllib3,requests,pyinstaller @@ -534,6 +610,10 @@ vhs: desc: Write terminal GIFs as code for integration testing and demoing your CLI tools. github: charmbracelet/vhs +viddy: + desc: modern watch command, time machine and pager + github: sachaos/viddy + vuls: desc: Agent-less vulnerability scanner for Linux, FreeBSD, Container, WordPress, Programming language libraries, Network devices github: future-architect/vuls @@ -555,7 +635,7 @@ wrk: github: wg/wrk ww: - fullname: webwormhole + name: webwormhole desc: creates ephemeral pipes between computers website: https://webwormhole.io/ @@ -573,6 +653,10 @@ xsv: desc: a fast CSV command line toolkit github: BurntSushi/xsv +yazi: + desc: terminal file manager + github: sxyazi/yazi + yq: desc: yq is a portable command-line YAML, JSON, XML, CSV, TOML and properties processor github: mikefarah/yq @@ -585,15 +669,15 @@ yq-py: website: https://kislyuk.github.io/yq/ tags: python, yaml +z: + name: zoxide + desc: A smarter cd command. Supports all major shells, inspired by z and autojump. + github: ajeetdsouza/zoxide + zee: desc: modern text editor for the terminal cargo: -z: - fullname: zoxide - desc: A smarter cd command. Supports all major shells, inspired by z and autojump. - github: ajeetdsouza/zoxide - zf: desc: a commandline fuzzy finder designed for filtering filepaths github: natecraddock/zf diff --git a/lint.py b/lint.py new file mode 100644 index 0000000..1291c92 --- /dev/null +++ b/lint.py @@ -0,0 +1,81 @@ +REQUIRED_KEYS = { + "desc", +} + +FORGE_KEYS = { + "github", + "gitlab", + "srht", # source hut, not "~" on the name + "bitbucket", +} + +PKG_KEYS = { + "pip", + "pipx", + "cargo", + "npm", + "hex", +} + +COMMON_KEYS = { + "status", # tells it cliget process has been tested on this tool + "website", + "tags", # may have a typo with "tag" no s + "name", # tool name when not exe name + "releases", # relases page if not on the forge/pkg +} + +KEYS = REQUIRED_KEYS | FORGE_KEYS | PKG_KEYS | COMMON_KEYS + + +def failed(*m): + print(" ERROR: ", *m) + + +def entries_sorted(catalog: dict) -> bool: # or my raise an error ? + keys = list(catalog.keys()) + for x, y in zip(keys, keys[1:]): + if y < x: + # TODO should yield + failed(x, "before", y) + return False + return True + + +def required(catalog: dict) -> bool: # or my raise an error ? + for k, v in catalog.items(): + keys = set(v.keys()) + for rkey in REQUIRED_KEYS: + if not rkey in keys: + failed(k, "has no", rkey) + return False + return True + + +def only_commons(catalog: dict) -> bool: + for k, v in catalog.items(): + for vk in v.keys(): + if not vk in KEYS: + failed(k, "should not have", vk) + return False + return True + + +RULES = [ + # (name, function) pairs + ("entries are sorted", entries_sorted), + ("required keys are present", required), + ("only common keys", only_commons), +] + +import sys +from yaml import safe_load + +catalog = safe_load(open(sys.argv[1], "rt")) + +for name, rule in RULES: + if rule(catalog): + print(name, "OK") + else: + print(name, "FAIL") + break