Replies: 3 comments
-
Interesting thought. I'll leave this open for more people to show their interest. Any reason to pick a specific script from the wiki rather than the one from the book? |
Beta Was this translation helpful? Give feedback.
-
Well, the wiki one includes help menu commands as well as task completions. Which is sufficient for most bb's use case I think. Also it has single dependency of bb. |
Beta Was this translation helpful? Give feedback.
-
Also slightly off topic as I was looking into how the go folks create their completion scripts, I found most of them were using a library called cobra. All the completions scripts almost come free this case. https://github.com/spf13/cobra/blob/main/shell_completions.md In clojure land, I guess we don't have that kind of libraries yet. Otherwise as we write standard tools.cli or babashka.cli and completion scripts come free would be a dream instead of hand craft them case by case. |
Beta Was this translation helpful? Give feedback.
-
The shell completion script mentioned in the wiki works pretty well. Wondering if bb can include them by default?
ie:
bb completion bash
bb completion zsh
The above commands can simply out print the default completion script ready for downstream consumption (brew, nixpkgs etc...)
Some downstream consumption examples for reference:
https://github.com/NixOS/nixpkgs/blob/dd3eded9880ec00d930b7f03a0f532416e2752c0/pkgs/development/web/flyctl/default.nix#L40
https://github.com/NixOS/nixpkgs/blob/dd3eded9880ec00d930b7f03a0f532416e2752c0/pkgs/applications/networking/cluster/kubernetes/kubectl.nix#L20
https://github.com/search?q=repo%3ANixOS%2Fnixpkgs%20installShellCompletion&type=code
https://github.com/superfly/flyctl/pull/603/files
Beta Was this translation helpful? Give feedback.
All reactions