cmd

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2016 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddCmd = &cobra.Command{
	Use:   "add PATH [PATH...]",
	Short: "Add file or folder to server",
	Long:  `Add file or folder to server`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			fmt.Println("Error: Empty arguments")
		}

		if err := lib.InitSettings(lib.ConfigFile(), &appSettings); err != nil {
			fmt.Printf("Error: %s\n", err.Error())
		}

		for _, arg := range args {
			if err := runAddCmd(arg, appSettings); err != nil {
				fmt.Printf("Error: %s\n", err.Error())
			}
		}
	},
}
View Source
var PsCmd = &cobra.Command{
	Use:   "ps",
	Short: "List files or folders from server",
	Long:  `List files or folders from server`,
	Run: func(cmd *cobra.Command, args []string) {
		if err := lib.InitSettings(lib.ConfigFile(), &appSettings); err != nil {
			fmt.Printf("Error: %s\n", err.Error())
		}

		runPsCmd(appSettings)
	},
}
View Source
var RmCmd = &cobra.Command{
	Use:   "rm UUID [UUID...]",
	Short: "Remove file or folder from server",
	Long:  `Remove file or folder from server`,
	Run: func(cmd *cobra.Command, args []string) {
		if len(args) == 0 {
			fmt.Println("Error: Empty arguments")
		}

		if err := lib.InitSettings(lib.ConfigFile(), &appSettings); err != nil {
			fmt.Printf("Error: %s\n", err.Error())
		}

		for _, arg := range args {
			runRmCmd(arg, appSettings)
		}
	},
}
View Source
var RootCmd = &cobra.Command{
	Use:   "share",
	Short: "Share is a cli to share quickly a file with http protocol",
	Long:  `Share is a cli to share quickly a file with http protocol with go. Complete documentation is available at https://github.com/devcows/share`,
	Run: func(cmd *cobra.Command, args []string) {
		fmt.Println("TODO use add, ps or rm")
	},
}
View Source
var ServerCmd = &cobra.Command{
	Use:   "server",
	Short: "Server APIREST",
	Long:  `Server APIREST`,
	Run: func(cmd *cobra.Command, args []string) {
		if err := runServerCmd(lib.ConfigFile(), &appSettings); err != nil {
			log.Error(fmt.Sprintf("Error: %s", err))
			os.Exit(-1)
		}

		log.Info("Running servers...")
		go lib.RunFileServer(appSettings)
		runShareServer(appSettings)
	},
}
View Source
var VersionCmd = &cobra.Command{
	Use:   "version",
	Short: "Print the version number of Share cli",
	Long:  `All software has versions. This is share cli's`,
	Run: func(cmd *cobra.Command, args []string) {
		runVersionCmd()
	},
}

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