-
Notifications
You must be signed in to change notification settings - Fork 988
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #177 from jon4hz/completion
ci: add autocompletion and manpage
- Loading branch information
Showing
8 changed files
with
97 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,8 @@ node_modules | |
.DS_Store | ||
|
||
/dist | ||
/completions/ | ||
/manpages/ | ||
|
||
# frontend | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
Copyright © 2022 NAME HERE <EMAIL ADDRESS> | ||
*/ | ||
package cmd | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
|
||
mcobra "github.com/muesli/mango-cobra" | ||
"github.com/muesli/roff" | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
var manCmd = &cobra.Command{ | ||
Use: "man", | ||
Short: "generates the manpages", | ||
SilenceUsage: true, | ||
DisableFlagsInUseLine: true, | ||
Hidden: true, | ||
Args: cobra.NoArgs, | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
manPage, err := mcobra.NewManPage(1, rootCmd) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
_, err = fmt.Fprint(os.Stdout, manPage.Build(roff.NewDocument())) | ||
return err | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(manCmd) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
set -e | ||
rm -rf completions | ||
mkdir completions | ||
cd cli | ||
for sh in bash zsh fish; do | ||
go run . completion "$sh" > "../completions/infisical.$sh" | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/sh | ||
set -e | ||
rm -rf manpages | ||
mkdir manpages | ||
cd cli | ||
go run . man | gzip -c > "../manpages/infisical.1.gz" |