Closed cmbankester closed 8 years ago
Hmm, I'll have to find an alternative to the column
command for the fish shell.
@cmbankester also, make sure whatever you come up with is amenable to cut
.
@jamesob Is the purpose of that for extracting name/description pairs?
I'd like to keep desk's output as machine-friendly as possible while still remaining practical for human readability.
I have also been considering attenuating the list command with an option for outputting only the names of the desks (for better integration into other systems, for instance). Thoughts?
:+1:
Probably best in a separate PR though.
I'd like to hear what other users think about a display change of this sort (@ofsaleem @rnewton @jonashaag @unixorn @eush77 @mblarsen @paulmolluzzo)
@cmbankester note that you'll also need to take the shell completion functions into consideration, e.g. https://github.com/jamesob/desk/blob/master/shell_plugins/bash/desk#L18
I like it, but I'd prefer if the standard output was default and this was toggled via a flag.
@jamesob Really good point. I'll take a look at the completion functions that reference list
. I'll also see about adding some tests to cover the completion functions (or at least the ones that I change).
@rnewton That's a good idea. Are you thinking with an ENV variable or with a command-line flag. Personally, I'd prefer the ENV var, but I can also understand if anyone would have reservations to that idea.
I like this change, this looks much more readable to me and parseable, too (you split by \s{2,}
instead of -
).
I like it, but I'd prefer if the standard output was default and this was toggled via a flag.
It should be the other way round. First, humans will type desk ls
many times, so it should very easy to type and have nice human-readable output. Secondly, if desk
is integrated in another program, it doesn't hurt to add --machine-readable
to that program's source code. So -- and this is a general rule for programs that are used by humans most of the time -- make human friendly by default and machine friendly by choice. See also Git's porcelain commands and the --porcelain
flag. Example: git status
is human-readable. git status --porcelain
is machine-readable.
@cmbankester I was thinking a flag + alias to your preferred output.
@jonashaag I can get behind that argument as well. I guess the biggest thing for me is the ability to toggle the type of output you get.
I went with @jonashaag's recommendation and set the default to be human readable. Let me know if I need to make any changes:
cbankester@Christians-iMac ~/P/c/desk> ./desk list
NAME DESCRIPTION
desk Desk for working on desk
dotnet Desk for working on .NET projects
cbankester@Christians-iMac ~/P/c/desk> ./desk list --machine-readable
desk - Desk for working on desk
dotnet - Desk for working on .NET projects
cbankester@Christians-iMac ~/P/c/desk> ./desk list --only-names
desk
dotnet
cbankester@Christians-iMac ~/P/c/desk> ./desk list --only-descriptions
Desk for working on desk
Desk for working on .NET projects
I implemented the --only-names
(/--only-descriptions
) flag before doing the --machine-readable
flag (to use with the completion code), so I figured I'd leave it in. Let me know if you want me to cherry pick it out.
Pretty nice idea @cmbankester! Certainly easier to know what's going on. That said, I don't know that the window width won't ever be an issue. I made a ridiculously long file name and description just to illustrate the point. The screenshot is using the "default" window size for my terminal. Granted, I expand it to full width just about every single time I open the window, but not everyone does, and if you use tmux
or screen
and have small panes you will probably see a similar issue.
Other than that edge case I'd say this is great!
@cmbankester thanks for your continued work here, especially on keeping the tests current. A few things:
--machine-readable
-> --no-tabulate
,--only-descriptions
if no one can think of any good usecases.We'll want to think about applying this same sort of tabulation to cmd_current
. My preference would be to include that change in this PR so that we maintain some consistency in the UI.
I'd recommend against using --no-tabulate
simply because we're not actually using any tabs, just spaces. Perhaps --columnize
?
@cmbankester maybe just --no-format
?
@jamesob I believe that make sense.
Alright, everything should be in order. Here's a sample of output from desk
(without a subcommand):
cbankester@Christians-iMac ~/P/c/desk> ./desk
desk - Desk for working on desk
foooooooooooooo Alias to echo the word 'foo'
bar Alias to echo the word 'bar'
and with the --no-format
option:
desk - Desk for working on desk
foooooooooooooo - Alias to echo the word 'foo'
bar - Alias to echo the word 'bar'
Also, my apologies for the strangely dense collection of git commits at the bottom of this PR. I rebased on your recent changes and force-pushed onto my master.
@cmbankester cool; just a few minor things. After you've pushed the changes, I'll pull and test manually. Would greatly appreciate it if you could condense this down either into a single commit or three or four meaningful segments with git rebase -i origin/master
; if you'd rather, I can do that.
@jamesob No problem, I'll squash after I make those changes.
@cmbankester looks great, thanks for the good work. Do you have a bitcoin wallet QR where I might be able to send a bit of gratitude?
@jamesob Thanks so much, but the usage of desk is gratitude enough! Thanks again for open-sourcing this fine piece of software!
Feel free to @-ping me anytime you want some input on other PRs or have ideas you'd like me to implement.
I updated the
cmd_list
function to output the available desks as a table instead of hyphen-delimiting them. See, e.g.:Before:
After:
Currently no way to take the terminal width into consideration when listing, but I honestly don't see that being much of an issue these days.
I have also been considering attenuating the
list
command with an option for outputting only the names of the desks (for better integration into other systems, for instance). Thoughts?