Browse Source

fix: package command

Yeuoly 8 months ago
parent
commit
be34b659ab
2 changed files with 5 additions and 3 deletions
  1. 1 1
      cmd/commandline/bundle.go
  2. 4 2
      cmd/commandline/plugin.go

+ 1 - 1
cmd/commandline/bundle.go

@@ -134,7 +134,7 @@ var (
 			// using filename of input_path as output_path if not specified
 			outputPath := ""
 
-			if c.Flag("output_path") != nil {
+			if c.Flag("output_path").Value.String() != "" {
 				outputPath = c.Flag("output_path").Value.String()
 			} else {
 				base := filepath.Base(bundlePath)

+ 4 - 2
cmd/commandline/plugin.go

@@ -19,7 +19,7 @@ var (
 	}
 
 	pluginPackageCommand = &cobra.Command{
-		Use:   "package plugin_path [-o output_path]",
+		Use:   "package [plugin_path]",
 		Short: "Package",
 		Long:  "Package plugins",
 		Args:  cobra.ExactArgs(1),
@@ -29,7 +29,7 @@ var (
 			// using filename of input_path as output_path if not specified
 			outputPath := ""
 
-			if cmd.Flag("output_path") != nil {
+			if cmd.Flag("output_path").Value.String() != "" {
 				outputPath = cmd.Flag("output_path").Value.String()
 			} else {
 				base := filepath.Base(inputPath)
@@ -108,4 +108,6 @@ func init() {
 	// pluginCommand.AddCommand(pluginTestCommand)
 	// pluginTestCommand.Flags().StringP("inputs", "i", "", "inputs")
 	// pluginTestCommand.Flags().StringP("timeout", "t", "", "timeout")
+
+	pluginPackageCommand.Flags().StringP("output_path", "o", "", "output path")
 }