cmd

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 17, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MultifileMaxConnPerHost     int
	MultifileMaxConcurrentFiles int
)

multifile mode config vars

View Source
var MultiFileCMD = &cobra.Command{
	Use:   "multifile [flags] <manifest-file>",
	Short: "download files from a manifest file in parallel",
	Long:  multiFileLongDesc,
	Args:  cobra.ExactArgs(1),
	PreRunE: func(cmd *cobra.Command, args []string) error {
		if viper.GetInt(optname.MaxConnPerHost) == 0 {
			viper.Set(optname.MaxConnPerHost, 40)
		}

		if viper.GetBool(optname.Extract) {
			return fmt.Errorf("cannot use --extract with multifile mode")
		}
		return nil
	},
	Run: func(cmd *cobra.Command, args []string) {
		if err := execMultifile(cmd, args); err != nil {
			logging.Logger.Error().Err(err).Msg("Error")
			os.Exit(1)
		}
	},
}
View Source
var RootCMD = &cobra.Command{
	Use:   "pget [flags] <url> <dest>",
	Short: "pget",
	Long:  rootLongDesc,
	PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
		return config.PersistentStartupProcessFlags()
	},
	Run: func(cmd *cobra.Command, args []string) {
		if err := rootExecFunc(cmd, args); err != nil {
			log.Error().Err(err).Msg("Error")
			os.Exit(1)
		}
	},
	Args: cobra.ExactArgs(2),
}
View Source
var VersionCMD = &cobra.Command{
	Use:   "version",
	Short: "print version and build information",
	Long:  "Print the version information",
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Printf("pget Version %s - Build Time %s\n", version.GetVersion(), version.BuildTime)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL