Add completions to package
This commit is contained in:
parent
7db2b9f030
commit
d185802c65
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
result
|
||||||
|
.direnv
|
@ -68,6 +68,13 @@
|
|||||||
pname = "natstonotify";
|
pname = "natstonotify";
|
||||||
src = src;
|
src = src;
|
||||||
vendorHash = "sha256-xAFxgUH2QUkmdCXJB4NzURozedgMIyawdf/g3vxOyC0=";
|
vendorHash = "sha256-xAFxgUH2QUkmdCXJB4NzURozedgMIyawdf/g3vxOyC0=";
|
||||||
|
nativeBuildInputs = [ pkgs.installShellFiles ];
|
||||||
|
postInstall = ''
|
||||||
|
installShellCompletion --cmd natstonotify \
|
||||||
|
--bash <($out/bin/natstonotify completion bash) \
|
||||||
|
--zsh <($out/bin/natstonotify completion zsh) \
|
||||||
|
--fish <($out/bin/natstonotify completion fish)
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
@ -78,6 +85,7 @@
|
|||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
go
|
go
|
||||||
golangci-lint
|
golangci-lint
|
||||||
|
(self.packages.${pkgs.system}.default)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
2
main.go
2
main.go
@ -62,6 +62,7 @@ func main() {
|
|||||||
{
|
{
|
||||||
Name: "server",
|
Name: "server",
|
||||||
Usage: "Start the server",
|
Usage: "Start the server",
|
||||||
|
EnableShellCompletion: true,
|
||||||
Action: func(ctx context.Context, cmd *cli.Command) error {
|
Action: func(ctx context.Context, cmd *cli.Command) error {
|
||||||
b, err := bus.NewNotifyBus()
|
b, err := bus.NewNotifyBus()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -109,6 +110,7 @@ func main() {
|
|||||||
Aliases: []string{"n"},
|
Aliases: []string{"n"},
|
||||||
Usage: "Send a notification",
|
Usage: "Send a notification",
|
||||||
ArgsUsage: "SUMMARY [BODY]",
|
ArgsUsage: "SUMMARY [BODY]",
|
||||||
|
EnableShellCompletion: true,
|
||||||
Flags: []cli.Flag{
|
Flags: []cli.Flag{
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "local",
|
Name: "local",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user