Skip to content

Commit

Permalink
Add command-not-found handler
Browse files Browse the repository at this point in the history
  • Loading branch information
Pandapip1 committed Sep 1, 2024
1 parent 062daa3 commit cb69790
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
4 changes: 4 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
wrapProgram $out/bin/comma \
--prefix PATH : ${lib.makeBinPath (with pkgs; [ nix fzy nix-index-unwrapped ])}
ln -s $out/bin/comma $out/bin/,
mkdir -p $out/etc/profile.d
cp $src/src/command-not-found.sh $out/etc/profile.d
patchShebangs $out/etc/profile.d/command-not-found.sh
'';
};
checkInputs = [ pkgs.rustPackages.clippy ];
Expand Down
13 changes: 13 additions & 0 deletions src/command-not-found.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh

# bash command not found handler
command_not_found_handle() {
../../bin/comma "$@"
return $?
}

# zsh compatibility
command_not_found_handler () {
command_not_found_handle "$@"
return $?
}

0 comments on commit cb69790

Please sign in to comment.