@@ -2,6 +2,7 @@ package cmd
2
2
3
3
import (
4
4
"context"
5
+ "fmt"
5
6
"log"
6
7
"os"
7
8
"path/filepath"
@@ -37,23 +38,23 @@ var createDirCmd = &cobra.Command{
37
38
allocationID := cmd .Flag ("allocation" ).Value .String ()
38
39
allocationObj , err := sdk .GetAllocation (allocationID )
39
40
if err != nil {
40
- PrintError ("Error fetching the allocation. " , err )
41
+ PrintError ("Error fetching the allocation" , err )
41
42
os .Exit (1 )
42
43
}
43
44
dirname := cmd .Flag ("dirname" ).Value .String ()
44
45
45
46
if err != nil {
46
- PrintError ("CreateDir failed. " , err )
47
+ PrintError ("CreateDir failed: " , err )
47
48
os .Exit (1 )
48
49
}
49
50
err = allocationObj .CreateDir (dirname )
50
51
51
52
if err != nil {
52
- PrintError ("CreateDir failed. " , err )
53
+ PrintError ("CreateDir failed: " , err )
53
54
os .Exit (1 )
54
55
}
55
56
56
- return
57
+ fmt . Println ( dirname + " directory created" )
57
58
},
58
59
}
59
60
@@ -64,17 +65,17 @@ var uploadCmd = &cobra.Command{
64
65
Long : `upload file to blobbers` ,
65
66
Args : cobra .MinimumNArgs (0 ),
66
67
Run : func (cmd * cobra.Command , args []string ) {
67
- fflags := cmd .Flags () // fflags is a *flag.FlagSet
68
- if fflags .Changed ("allocation" ) == false { // check if the flag "path" is set
68
+ fflags := cmd .Flags () // fflags is a *flag.FlagSet
69
+ if ! fflags .Changed ("allocation" ) { // check if the flag "path" is set
69
70
PrintError ("Error: allocation flag is missing" ) // If not, we'll let the user know
70
71
os .Exit (1 ) // and return
71
72
}
72
- if fflags .Changed ("remotepath" ) == false {
73
+ if ! fflags .Changed ("remotepath" ) {
73
74
PrintError ("Error: remotepath flag is missing" )
74
75
os .Exit (1 )
75
76
}
76
77
77
- if fflags .Changed ("localpath" ) == false {
78
+ if ! fflags .Changed ("localpath" ) {
78
79
PrintError ("Error: localpath flag is missing" )
79
80
os .Exit (1 )
80
81
}
@@ -141,8 +142,6 @@ var uploadCmd = &cobra.Command{
141
142
commitMetaTxn (remotepath , "Upload" , "" , "" , allocationObj , nil , statusBar )
142
143
statusBar .wg .Wait ()
143
144
}
144
-
145
- return
146
145
},
147
146
}
148
147
0 commit comments