Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated nix completer with the new flake APIs #2350

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

aftix
Copy link
Contributor

@aftix aftix commented Apr 16, 2024

  • Created an ActionInstallables for installables from flakes or nixpkgs
  • Added --stdin flags to commands taking installables
  • Added several subcommands under nix flake
  • Removed old subcommands that have been renamed or removed from the nix program

Due to #2348 (comment) tab completion for flake outputs was not implemented. Also, nix help follows the somewhat common pattern of putting subcommands as positional arguments such as nix help flake show to show help for nix flake show. I wasn't aware of a good programatic way to generate those completions.

@rsteube
Copy link
Member

rsteube commented Apr 16, 2024

Regarding the help command:

carapace.Gen(helpCmd).PositionalAnyCompletion(
    carapace.ActionCommands(rootCmd),
)

e.g.

carapace.ActionCommands(rootCmd),

@aftix
Copy link
Contributor Author

aftix commented Apr 16, 2024

I've added the ActionCommands to nix help and rebased against master again

pkg/actions/tools/nix/develop.go Outdated Show resolved Hide resolved
pkg/actions/tools/nix/develop.go Outdated Show resolved Hide resolved
pkg/actions/tools/nix/develop.go Outdated Show resolved Hide resolved
pkg/actions/tools/nix/develop.go Outdated Show resolved Hide resolved
pkg/actions/tools/nix/installables.go Show resolved Hide resolved
pkg/actions/tools/nix/templates.go Outdated Show resolved Hide resolved
pkg/actions/tools/nix/develop.go Outdated Show resolved Hide resolved
pkg/actions/tools/nix/develop.go Show resolved Hide resolved
completers/nix_completer/cmd/derivationAdd.go Outdated Show resolved Hide resolved
@aftix
Copy link
Contributor Author

aftix commented Apr 17, 2024

I've made the requested changes, but wasn't exactly sure what kind of error messages would be good on failure

@rsteube
Copy link
Member

rsteube commented Apr 17, 2024

Just err.Error() is fine.

	- Created an ActionInstallables for installables from flakes or nixpkgs
	- Added `--stdin` flags to commands taking installables
	- Added several subcommands under `nix flake`
	- Removed old subcommands that have been renamed or removed from the nix program
@aftix
Copy link
Contributor Author

aftix commented Apr 17, 2024

I've updated the ActionMessage calls to use err.Error()

@rsteube rsteube merged commit 49418e2 into carapace-sh:master Apr 17, 2024
3 checks passed
@rsteube
Copy link
Member

rsteube commented Apr 17, 2024

thanks

@aftix aftix deleted the update_nix branch April 18, 2024 00:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants