@@ -30,9 +30,11 @@ const (
30
30
31
31
var AddCmd = & cmds.Command {
32
32
Helptext : cmds.HelpText {
33
- Tagline : "Add a file or directory to ipfs." ,
33
+ Tagline : "Add a file to ipfs." ,
34
34
ShortDescription : `
35
- Adds contents of <path> to ipfs. Use -r to add directories (recursively).
35
+ Adds contents of <path> to ipfs. Use -r to add directories.
36
+ Note that directories are added recursively, to form the ipfs
37
+ MerkleDAG.
36
38
` ,
37
39
LongDescription : `
38
40
Adds contents of <path> to ipfs. Use -r to add directories.
@@ -61,29 +63,21 @@ You can now refer to the added file in a gateway, like so:
61
63
},
62
64
Options : []cmds.Option {
63
65
cmds .OptionRecursivePath , // a builtin option that allows recursive paths (-r, --recursive)
64
- cmds .BoolOption (quietOptionName , "q" , "Write minimal output." ),
65
- cmds .BoolOption (silentOptionName , "Write no output." ),
66
- cmds .BoolOption (progressOptionName , "p" , "Stream progress data." ),
67
- cmds .BoolOption (trickleOptionName , "t" , "Use trickle-dag format for dag generation." ),
68
- cmds .BoolOption (onlyHashOptionName , "n" , "Only chunk and hash - do not write to disk." ),
69
- cmds .BoolOption (wrapOptionName , "w" , "Wrap files with a directory object." ),
70
- cmds .BoolOption (hiddenOptionName , "H" , "Include files that are hidden. Only takes effect on recursive add." ),
66
+ cmds .BoolOption (quietOptionName , "q" , "Write minimal output." ). Default ( false ) ,
67
+ cmds .BoolOption (silentOptionName , "Write no output." ). Default ( false ) ,
68
+ cmds .BoolOption (progressOptionName , "p" , "Stream progress data." ). Default ( true ) ,
69
+ cmds .BoolOption (trickleOptionName , "t" , "Use trickle-dag format for dag generation." ). Default ( false ) ,
70
+ cmds .BoolOption (onlyHashOptionName , "n" , "Only chunk and hash - do not write to disk." ). Default ( false ) ,
71
+ cmds .BoolOption (wrapOptionName , "w" , "Wrap files with a directory object." ). Default ( false ) ,
72
+ cmds .BoolOption (hiddenOptionName , "H" , "Include files that are hidden. Only takes effect on recursive add." ). Default ( false ) ,
71
73
cmds .StringOption (chunkerOptionName , "s" , "Chunking algorithm to use." ),
72
- cmds .BoolOption (pinOptionName , "Pin this object when adding. Default: true." ),
74
+ cmds .BoolOption (pinOptionName , "Pin this object when adding." ). Default ( true ),
73
75
},
74
76
PreRun : func (req cmds.Request ) error {
75
77
if quiet , _ , _ := req .Option (quietOptionName ).Bool (); quiet {
76
78
return nil
77
79
}
78
80
79
- // ipfs cli progress bar defaults to true
80
- progress , found , _ := req .Option (progressOptionName ).Bool ()
81
- if ! found {
82
- progress = true
83
- }
84
-
85
- req .SetOption (progressOptionName , progress )
86
-
87
81
sizeFile , ok := req .Files ().(files.SizeFile )
88
82
if ! ok {
89
83
// we don't need to error, the progress bar just won't know how big the files are
@@ -129,11 +123,7 @@ You can now refer to the added file in a gateway, like so:
129
123
hidden , _ , _ := req .Option (hiddenOptionName ).Bool ()
130
124
silent , _ , _ := req .Option (silentOptionName ).Bool ()
131
125
chunker , _ , _ := req .Option (chunkerOptionName ).String ()
132
- dopin , pin_found , _ := req .Option (pinOptionName ).Bool ()
133
-
134
- if ! pin_found { // default
135
- dopin = true
136
- }
126
+ dopin , _ , _ := req .Option (pinOptionName ).Bool ()
137
127
138
128
if hash {
139
129
nilnode , err := core .NewNode (n .Context (), & core.BuildCfg {
@@ -220,7 +210,7 @@ You can now refer to the added file in a gateway, like so:
220
210
return
221
211
}
222
212
223
- progress , prgFound , err := req .Option (progressOptionName ).Bool ()
213
+ progress , _ , err := req .Option (progressOptionName ).Bool ()
224
214
if err != nil {
225
215
res .SetError (u .ErrCast (), cmds .ErrNormal )
226
216
return
@@ -233,9 +223,7 @@ You can now refer to the added file in a gateway, like so:
233
223
}
234
224
235
225
var showProgressBar bool
236
- if prgFound {
237
- showProgressBar = progress
238
- } else if ! quiet && ! silent {
226
+ if ! progress && ! quiet && ! silent {
239
227
showProgressBar = true
240
228
}
241
229
0 commit comments