feat: add --long as alias for -l in files.ls
Allow passing --long or ?long=true as a more descriptive option name than "l". refs: https://github.com/ipfs/go-ipfs#issuecomment-392477565
Alan Shaw committed
Jul 17, 2019 at 15:17 UTC
76f29603a8fbc369f188da7794425f8b82483cfc
2 files changed
+9
-3
core/commands/files.go
+2
-2
@@ -379,7 +379,7 @@ type filesLsOutput struct {
379
}
380
381
const (
382
- longOptionName = "l"
382
+ longOptionName = "long"
383
dontSortOptionName = "U"
384
)
385
@@ -408,7 +408,7 @@ Examples:
408
cmds.StringArg("path", false, false, "Path to show listing for. Defaults to '/'."),
409
},
410
Options: []cmds.Option{
411
- cmds.BoolOption(longOptionName, "Use long listing format."),
411
+ cmds.BoolOption(longOptionName, "l", "Use long listing format."),
412
cmds.BoolOption(dontSortOptionName, "Do not sort; list entries in directory order."),
413
},
414
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
test/sharness/t0250-files-api.sh
+7
-1
@@ -202,6 +202,12 @@ test_files_api() {
202
test_cmp ls_l_expected ls_l_actual
203
'
204
205
+ test_expect_success "file has correct hash and size listed with --long" '
206
+ echo "file1 $FILE1 4" > ls_l_expected &&
207
+ ipfs files ls --long /cats/file1 > ls_l_actual &&
208
+ test_cmp ls_l_expected ls_l_actual
209
+ '
210
+
211
test_expect_success "file has correct hash and size listed with -l --cid-base=base32" '
212
echo "file1 `cid-fmt -v 1 -b base32 %s $FILE1` 4" > ls_l_expected &&
213
ipfs files ls --cid-base=base32 -l /cats/file1 > ls_l_actual &&
@@ -436,7 +442,7 @@ test_files_api() {
442
test_expect_success "file hash correct $EXTRA" '
443
echo $FILE_HASH > filehash_expected &&
444
ipfs files stat --hash /cats/ipfs > filehash &&
439
- test_cmp filehash_expected filehash
445
+ test_cmp filehash_expected filehash
446
'
447
448
test_expect_success "cant write to negative offset $EXTRA" '