Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add --long as alias for -l in files.ls #6528

Merged
merged 1 commit into from
Jul 17, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/commands/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ type filesLsOutput struct {
}

const (
longOptionName = "l"
longOptionName = "long"
dontSortOptionName = "U"
)

Expand Down Expand Up @@ -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 {
Expand Down
8 changes: 7 additions & 1 deletion test/sharness/t0250-files-api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &&
Expand Down Expand Up @@ -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" '
Expand Down