Skip to content

Commit

Permalink
Generate completion files
Browse files Browse the repository at this point in the history
  • Loading branch information
avdv committed Jan 25, 2024
1 parent 46d5b17 commit d22970a
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 3 deletions.
5 changes: 4 additions & 1 deletion app/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
};
nativeBuildInputs = with pkgs; [
git
installShellFiles
python3
];
devTools = let inherit (pkgs) bazel-watcher buildifier haskell-language-server lib; in
Expand Down Expand Up @@ -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 )
'';
};
};
Expand Down
3 changes: 2 additions & 1 deletion src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ data Options = Options
{ varName :: String,
watchFiles :: [String],
useStdin :: Bool,
cmdline :: [String]
command :: String,
args :: [String]
}
deriving (Show)
3 changes: 2 additions & 1 deletion src/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d22970a

Please sign in to comment.