Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ categories = [ "command-line-utilities" ]
include = [ "LICENSE", "README.md", "doc", "src" ]

[dependencies]
caress = "0.3.0"
libc = "0.2.186"
miniz_oxide = { version = "0.9.1", features = [ "std" ] }
nom = "8.0.0"
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ see `doc/` for details:
- [runtime completions](doc/runtime-completions.md) — on-the-fly caching via the completer
- [changelog](CHANGELOG.md) — breaking changes between releases

## shell completions

the nix package installs completions for bash, zsh, fish and nushell. to set
completions up by hand, source the script inshellah prints.

| shell | setup |
|--------|--------------------------------------------------------------------|
| bash | `source <(COMPLETE=bash inshellah)` |
| zsh | `COMPLETE=zsh inshellah > ~/.zfunc/_inshellah`, with it in `fpath` |
| fish | `COMPLETE=fish inshellah \| source` |
| nu | `COMPLETE=nu inshellah \| save inshellah.nu`, then `source` it |
| elvish | `eval (env COMPLETE=elvish inshellah \| slurp)` |

## license

EUPL-1.2. see [LICENSE](LICENSE)
18 changes: 18 additions & 0 deletions nix/package.nix
Original file line number Diff line number Diff line change
@@ -1,14 +1,32 @@
{
lib,
stdenv,
buildPackages,
rustPlatform,
installShellFiles,
nushell,
}:
rustPlatform.buildRustPackage {
pname = "inshellah";
version = (lib.importTOML ../Cargo.toml).package.version;
src = import ./src.nix lib;
cargoLock.lockFile = ../Cargo.lock;
nativeBuildInputs = [ installShellFiles ];
nativeCheckInputs = [ nushell ];

postInstall = lib.optionalString (stdenv.hostPlatform.emulatorAvailable buildPackages) (
let
inshellah = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/inshellah";
in
''
installShellCompletion --cmd inshellah \
--bash <(COMPLETE=bash ${inshellah}) \
--zsh <(COMPLETE=zsh ${inshellah}) \
--fish <(COMPLETE=fish ${inshellah}) \
--nushell <(COMPLETE=nu ${inshellah})
''
);

meta = {
description = "nushell completion indexer";
mainProgram = "inshellah";
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ fn resolve_dirs(dirs: Dirs) -> Vec<PathBuf> {
}

fn main() {
caress::handle(Cli::SPEC);
// rust ignores SIGPIPE, so a broken-pipe write becomes a BrokenPipe error
// that `println!` panics on. restore the default so piping into `head`
// exits quietly.
Expand Down
Loading