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)
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
14
main.go
14
main.go
@ -60,8 +60,9 @@ func main() {
|
|||||||
Usage: "NATS-powered notification service",
|
Usage: "NATS-powered notification service",
|
||||||
Commands: []*cli.Command{
|
Commands: []*cli.Command{
|
||||||
{
|
{
|
||||||
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 {
|
||||||
@ -105,10 +106,11 @@ func main() {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Name: "notify",
|
Name: "notify",
|
||||||
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