feat(completion): Add path completion#150
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
carapace supports usage of cobra completions.
IMO it is probably far simpler to specify the ValidArgsFunction attribute for each *cobra.Command instance that requires it, and return completion directives there that carapace then picks up, like so:
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
if build.Flake() {
return nil, cobra.ShellCompDirectiveFilterDirs
} else {
return nil, cobra.ShellCompDirectiveDefault
}
},you can adapt as needed for other positional arguments.
fe1da2b to
cdd9d84
Compare
|
So something like this? I also added nix file extension filtering for the legacy |
water-sucks
left a comment
There was a problem hiding this comment.
This is looking good! Just one small change :}
cdd9d84 to
b3e1ea3
Compare
water-sucks
left a comment
There was a problem hiding this comment.
Thanks for all the changes!
This adds:
apply,installandrepl[FLAKE-REF])[FILE])--root,--system--channel,--root,--system--dir,--root--flake--file