working commit
This commit is contained in:
+45
-4
@@ -20,10 +20,40 @@ func (util *Util) AddFileCmds() {
|
||||
putFileCmd.Flags().StringVarP(&util.putFileParams.Dest, "dest", "d", "", "Desctination path")
|
||||
|
||||
subCmd.AddCommand(putFileCmd)
|
||||
util.rootCmd.AddCommand(subCmd)
|
||||
|
||||
var getFileCmd = &cobra.Command{
|
||||
Use: "put",
|
||||
Short: "Put file to storage",
|
||||
Run: util.PutFile,
|
||||
}
|
||||
getFileCmd.Flags().StringVarP(&util.getFileParams.Username, "username", "u", "", "Username")
|
||||
getFileCmd.Flags().StringVarP(&util.getFileParams.Password, "password", "p", "", "Password")
|
||||
getFileCmd.Flags().StringVarP(&util.getFileParams.Source, "source", "s", "", "Source path")
|
||||
getFileCmd.Flags().StringVarP(&util.getFileParams.Dest, "dest", "d", "", "Desctination path")
|
||||
|
||||
subCmd.AddCommand(getFileCmd)
|
||||
|
||||
util.rootCmd.AddCommand(subCmd)
|
||||
}
|
||||
|
||||
type FileUtil struct {
|
||||
fileExists FileExistsParams
|
||||
putFileParams PutFileParams
|
||||
getFileParams GetFileParams
|
||||
deleteFileParams DeleteFileParams
|
||||
}
|
||||
|
||||
// File exists
|
||||
type FileExistsParams struct {
|
||||
Filepath string
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
|
||||
func (util *Util) FileExists(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
|
||||
// Put file
|
||||
type PutFileParams struct {
|
||||
Source string
|
||||
Dest string
|
||||
@@ -31,8 +61,10 @@ type PutFileParams struct {
|
||||
Password string
|
||||
}
|
||||
|
||||
func (util *Util) PutFile(cmd *cobra.Command, args []string) {}
|
||||
func (util *FileUtil) PutFile(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
|
||||
// Get file
|
||||
type GetFileParams struct {
|
||||
Source string
|
||||
Dest string
|
||||
@@ -40,6 +72,15 @@ type GetFileParams struct {
|
||||
Password string
|
||||
}
|
||||
|
||||
func (util *Util) GetFile(cmd *cobra.Command, args []string) {}
|
||||
func (util *FileUtil) GetFile(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
|
||||
func (util *Util) DeleteFile(cmd *cobra.Command, args []string) {}
|
||||
// Delete file
|
||||
type DeleteFileParams struct {
|
||||
Filepath string
|
||||
Username string
|
||||
Password string
|
||||
}
|
||||
|
||||
func (util *FileUtil) DeleteFile(cmd *cobra.Command, args []string) {
|
||||
}
|
||||
|
||||
@@ -21,8 +21,8 @@ func main() {
|
||||
}
|
||||
|
||||
type Util struct {
|
||||
rootCmd *cobra.Command
|
||||
putFileParams PutFileParams
|
||||
FileUtil
|
||||
rootCmd cobra.Command
|
||||
}
|
||||
|
||||
func NewUtil() *Util {
|
||||
@@ -31,7 +31,7 @@ func NewUtil() *Util {
|
||||
|
||||
func (util *Util) Build() error {
|
||||
var err error
|
||||
rootCmd := &cobra.Command{
|
||||
rootCmd := cobra.Command{
|
||||
Use: "cmd",
|
||||
Short: "A brief description the command",
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user