Skip to content

Commit

Permalink
Install shell completion for nix (#8)
Browse files Browse the repository at this point in the history
When installing via nix, the shell completions are generated as a post install step.
  • Loading branch information
eikek authored Jul 10, 2024
1 parent db9c365 commit 2ae4cc9
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
29 changes: 29 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,32 @@ form of linux, try `*-amd64` or `*-aarch64`. Last for Windows use the
Once downloaded, you can simply execute it without any further
installation step.

#### shell completion

For convenience, the cli tool can generate completion commands for
several shells. You can use it for inclusion in your `.bashrc` or
similar setups.

For example:

``` bash rnk:silent
rnk shell-completion --shell bash
```

will generate the completions for bash. These have to be "sourced"
into into your current shell:

``` bash
eval "$(rnk shell-completion --shell bash)"
```

Add this line to your `.bashrc` to have these completions available
when you enter bash.

With this enabled, when you type `rnk <tab>` you will be presented
with possible options, that are narrowed down the more letters you
type.

### Nix User

If you are a nix user and have flakes enabled, you can install rnk
Expand All @@ -34,6 +60,9 @@ If you want to try it out without installing:
nix run github:SwissDatascienceCenter/renku-cli
```

When installing the package via `install` or including it into your
NixOS configuration, the shell completions are already installed.

### Debian/Ubuntu User

TODO
Expand Down
7 changes: 7 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
[
# Add additional build inputs here
pkgs.openssl
pkgs.installShellFiles
]
++ lib.optionals pkgs.stdenv.isDarwin [
# Additional darwin specific inputs can be set here
Expand Down Expand Up @@ -85,6 +86,12 @@
inherit cargoArtifacts;
# additional arguments to cargo for building the app, --release is already there
cargoExtraArgs = "";
postInstall = ''
for shell in fish zsh bash; do
$out/bin/rnk shell-completion --shell $shell > rnk.$shell
installShellCompletion --$shell rnk.$shell
done
'';
});
in {
checks = {
Expand Down

0 comments on commit 2ae4cc9

Please sign in to comment.