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

ls headers should be a flag #893

Closed
2 tasks
jbenet opened this issue Mar 8, 2015 · 5 comments · Fixed by #951
Closed
2 tasks

ls headers should be a flag #893

jbenet opened this issue Mar 8, 2015 · 5 comments · Fixed by #951
Labels
help wanted Seeking public contribution on this issue

Comments

@jbenet
Copy link
Member

jbenet commented Mar 8, 2015

ipfs ls recently learned to show headers:

> ipfs ls QmVQ1XvYGF19X4eJqz1s7FJYJqAxFC4oqh3vWJJEXn66cp
Hash                                           Size   Name
QmajFHHivh25Qb2cNbnnnEeUe1gDLHX9ta7hs2XKX1vazb 139795 cat.jpg
QmNtpA5TBNqHrKf3cLQ1AiUKXiE4JmUodbG5gXrajg8wdv 277    test/
QmWNj1pTSjbauDHpdyg5HQ26vYcNWnubg1JehmwAE9NnU9 862825 tree-in-cosmos.jpg

Which is great! :)
but it broke people's scripts :( -- and i think it should be opt-in.

This is a format change, and those should be done carefully, as they are liable to break other things or introduce subtle problems for users or programs. (I CRed this and didnt notice this, so it's my fault really.)

Let's:

  • make it only be turned on with a flag (i suggest -h, --header or something similar)
  • add somewhere to some dev doc that PRs that change format should be clearly indicated and require a LGTM from the format maintainer (@jbenet for the moment)
@chriscool
Copy link
Contributor

-h is usually for help

@cryptix
Copy link
Contributor

cryptix commented Mar 8, 2015

How about -q for quite?

We may also think about detecting an interactive shell and switching this kind of beautification off or on automatically. Personally I lean towards beautification on by default.

@chriscool
Copy link
Contributor

You mean -q for "quiet" or for "quite"? It could be also -r for "raw", except if we want to keep it for "reverse" (like in the regular ls command).

It can be disturbing when the output is different depending on the shell being interactive or not. It is often ok do desactivate colors, progress bars and asking questions when non interactive (and even then it could depend on people using pagers like less to look at the output), but otherwise I would not recommend it.

@jbenet
Copy link
Member Author

jbenet commented Mar 9, 2015

-h is usually for help

wow. how did i... -- yeah, so --headers ? --hdr?

How about -q for quite?

quiet is for reducing output to the bare essentials. in ls, -q should return just the hashes or filenames. (there's an argument to be made for ls returning just the filenames, and ls -l returning the whole listing, but i think most people are interested in the hashes too).

I think default outputs should be a balance between comfort for new users, comfort for users who will use it all the time, and ease of scripting. after getting to know what the columns of ipfs ls <hash> are, which can be done checking ipfs ls --help, the headers are not necessary.

It can be disturbing when the output is different depending on the shell being interactive or not.

Entirely agreed. stdout output should not differ. It can be the source of much confusion.

@chriscool
Copy link
Contributor

Ok for --headers.

@whyrusleeping whyrusleeping added the help wanted Seeking public contribution on this issue label Mar 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Seeking public contribution on this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants