46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package main
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func (util *Util) AddFileCmds() {
|
|
var subCmd = &cobra.Command{
|
|
Use: "file",
|
|
Short: "File operation",
|
|
}
|
|
var putFileCmd = &cobra.Command{
|
|
Use: "put",
|
|
Short: "Put file to storage",
|
|
Run: util.PutFile,
|
|
}
|
|
putFileCmd.Flags().StringVarP(&util.putFileParams.Username, "username", "u", "", "Username")
|
|
putFileCmd.Flags().StringVarP(&util.putFileParams.Password, "password", "p", "", "Password")
|
|
putFileCmd.Flags().StringVarP(&util.putFileParams.Source, "source", "s", "", "Source path")
|
|
putFileCmd.Flags().StringVarP(&util.putFileParams.Dest, "dest", "d", "", "Desctination path")
|
|
|
|
subCmd.AddCommand(putFileCmd)
|
|
util.rootCmd.AddCommand(subCmd)
|
|
|
|
}
|
|
|
|
type PutFileParams struct {
|
|
Source string
|
|
Dest string
|
|
Username string
|
|
Password string
|
|
}
|
|
|
|
func (util *Util) PutFile(cmd *cobra.Command, args []string) {}
|
|
|
|
type GetFileParams struct {
|
|
Source string
|
|
Dest string
|
|
Username string
|
|
Password string
|
|
}
|
|
|
|
func (util *Util) GetFile(cmd *cobra.Command, args []string) {}
|
|
|
|
func (util *Util) DeleteFile(cmd *cobra.Command, args []string) {}
|