diff --git a/app/Main.hs b/app/Main.hs index e64235e..850abe7 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -34,7 +34,10 @@ options = <> short 'i' <> help "read input from stdin, pipe into program continually" ) - <*> some (argument str (metavar "COMMAND ARGS")) + <*> argument str + ( metavar "COMMAND" + <> action "command" ) + <*> some (argument str (metavar "[ARGS]")) main :: IO () main = do diff --git a/flake.nix b/flake.nix index 27730f1..72d09f1 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,7 @@ }; nativeBuildInputs = with pkgs; [ git + installShellFiles python3 ]; devTools = let inherit (pkgs) bazel-watcher buildifier haskell-language-server lib; in @@ -73,6 +74,11 @@ ''; installPhase = '' install -D -t $out/bin bazel-bin/replay + + installShellCompletion --cmd replay \ + --bash <( bazel-bin/replay --bash-completion-script $out/bin/replay ) \ + --fish <( bazel-bin/replay --fish-completion-script $out/bin/replay ) \ + --zsh <( bazel-bin/replay --zsh-completion-script $out/bin/replay ) ''; }; }; diff --git a/src/Lib.hs b/src/Lib.hs index 8552d56..e819c3b 100644 --- a/src/Lib.hs +++ b/src/Lib.hs @@ -20,6 +20,7 @@ data Options = Options { varName :: String, watchFiles :: [String], useStdin :: Bool, - cmdline :: [String] + command :: String, + args :: [String] } deriving (Show) diff --git a/src/UI.hs b/src/UI.hs index 78316ba..6fda2a0 100644 --- a/src/UI.hs +++ b/src/UI.hs @@ -111,7 +111,8 @@ rerun = do state <- gets formState let text = state ^. input - cmdargs = cmdline $ options state + opt = options state + cmdargs = command opt : args opt out <- liftIO do let stdin = state ^. stdInput runExceptT $ getOutput cmdargs (DT.unpack text) stdin