(out io.Writer)
| 51 | } |
| 52 | |
| 53 | func newPluginPackageCmd(out io.Writer) *cobra.Command { |
| 54 | o := &pluginPackageOptions{} |
| 55 | |
| 56 | cmd := &cobra.Command{ |
| 57 | Use: "package [PATH]", |
| 58 | Short: "package a plugin directory into a plugin archive", |
| 59 | Long: pluginPackageDesc, |
| 60 | Args: require.ExactArgs(1), |
| 61 | RunE: func(_ *cobra.Command, args []string) error { |
| 62 | o.pluginPath = args[0] |
| 63 | return o.run(out) |
| 64 | }, |
| 65 | } |
| 66 | |
| 67 | f := cmd.Flags() |
| 68 | f.BoolVar(&o.sign, "sign", true, "use a PGP private key to sign this plugin") |
| 69 | f.StringVar(&o.key, "key", "", "name of the key to use when signing. Used if --sign is true") |
| 70 | f.StringVar(&o.keyring, "keyring", defaultKeyring(), "location of a public keyring") |
| 71 | f.StringVar(&o.passphraseFile, "passphrase-file", "", "location of a file which contains the passphrase for the signing key. Use \"-\" to read from stdin.") |
| 72 | f.StringVarP(&o.destination, "destination", "d", ".", "location to write the plugin tarball.") |
| 73 | |
| 74 | return cmd |
| 75 | } |
| 76 | |
| 77 | func (o *pluginPackageOptions) run(out io.Writer) error { |
| 78 | // Check if the plugin path exists and is a directory |
no test coverage detected
searching dependent graphs…