support nixos command-not-found, closes #912 (#922)

This commit is contained in:
Tycho Grouwstra
2019-06-26 20:01:02 +02:00
committed by Vladimir Iakovlev
parent 59dc6cbf90
commit 48e1e4217f
4 changed files with 44 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
import re
from thefuck.specific.nix import nix_available
from thefuck.shells import shell
regex = re.compile(r'nix-env -iA ([^\s]*)')
enabled_by_default = nix_available
def match(command):
return regex.findall(command.output)
def get_new_command(command):
name = regex.findall(command.output)[0]
return shell.and_('nix-env -iA {}'.format(name), command.script)
+3
View File
@@ -0,0 +1,3 @@
from thefuck.utils import which
nix_available = bool(which('nix'))