maralorn / nix-output-monitor

Pipe your nix-build output through the nix-output-monitor a.k.a nom to get additional information while building.
GNU Affero General Public License v3.0
835 stars 24 forks source link

feat: add bash completion #123

Open tomberek opened 9 months ago

tomberek commented 9 months ago

Note: this is just for the nom <subcommand> usage. But a similar trick can be used for nom-build.

Adds bash completion calling nix's and correcting the order of the args.

Another approach would be to call the normal bash nix completion but correct for the additional three arguments injected by nom, but this seems a bit cleaner to chain load the completion script.

Fixes: https://github.com/maralorn/nix-output-monitor/issues/31

maralorn commented 9 months ago

Thank you very much. This is a long-awaited improvement! I left a few comments.

maralorn commented 7 months ago

Have you tested this successfully? When I test this I get the output below, where I think the noise with the "Finished at" will probably break completion? At least completion didn’t work for me in a nix shell.


[maralorn@hephaistos:~]$ NIX_GET_COMPLETIONS=1 nix build pkgs#
normal
build   

[maralorn@hephaistos:~]$ NIX_GET_COMPLETIONS=1 nom build pkgs#
Finished at 22:26:31 after 0s
normal
build   
philiptaron commented 5 months ago

I also was unable to get this to work at all, even with futzing to remove runMonitoredCommand when NIX_GET_COMPLETIONS was set. (The Finished at 22:26:31 after 0s is coming from the runMonitoredCommand code.)