Commit 76f29603 authored by Alan Shaw's avatar Alan Shaw

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
parent 920572b9
......@@ -379,7 +379,7 @@ type filesLsOutput struct {
}
const (
longOptionName = "l"
longOptionName = "long"
dontSortOptionName = "U"
)
......@@ -408,7 +408,7 @@ Examples:
cmds.StringArg("path", false, false, "Path to show listing for. Defaults to '/'."),
},
Options: []cmds.Option{
cmds.BoolOption(longOptionName, "Use long listing format."),
cmds.BoolOption(longOptionName, "l", "Use long listing format."),
cmds.BoolOption(dontSortOptionName, "Do not sort; list entries in directory order."),
},
Run: func(req *cmds.Request, res cmds.ResponseEmitter, env cmds.Environment) error {
......
......@@ -202,6 +202,12 @@ test_files_api() {
test_cmp ls_l_expected ls_l_actual
'
test_expect_success "file has correct hash and size listed with --long" '
echo "file1 $FILE1 4" > ls_l_expected &&
ipfs files ls --long /cats/file1 > ls_l_actual &&
test_cmp ls_l_expected ls_l_actual
'
test_expect_success "file has correct hash and size listed with -l --cid-base=base32" '
echo "file1 `cid-fmt -v 1 -b base32 %s $FILE1` 4" > ls_l_expected &&
ipfs files ls --cid-base=base32 -l /cats/file1 > ls_l_actual &&
......@@ -436,7 +442,7 @@ test_files_api() {
test_expect_success "file hash correct $EXTRA" '
echo $FILE_HASH > filehash_expected &&
ipfs files stat --hash /cats/ipfs > filehash &&
test_cmp filehash_expected filehash
test_cmp filehash_expected filehash
'
test_expect_success "cant write to negative offset $EXTRA" '
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment