torus-cli icon indicating copy to clipboard operation
torus-cli copied to clipboard

Style guide - White space and layout

Open jeffandersen opened this issue 7 years ago • 11 comments

Placeholder for discussion about these facets of the style guide.

Talking points

  • Newlines after command input
  • Tabwriter spacing
  • General newline usage
  • Table column spacing

jeffandersen avatar Dec 06 '16 14:12 jeffandersen

My opinion:

  • No newline after command
  • Newline after primary output, then final message (ie. success/failure)
  • Tabwriter/table spacing should be 8

jeffandersen avatar Dec 12 '16 14:12 jeffandersen

Something I just thought about: Everything should word wrap!

We can easily determine the window size on execution, and wrap text accordingly. This means that all the other elements (tables, lists, errors etc) should obey this too.

jeffandersen avatar Dec 12 '16 14:12 jeffandersen

Word wrap, yes!

@jeffandersen

No newline after command

This one is pretty inconsistent in our current version, agreed it should be no newline.

ntassone avatar Dec 12 '16 16:12 ntassone

The question that I know @jbowes will have strong opinion on is whether you do newline after all the output. A lot of product CLIs do this, but very few system utilities do.

$ torus cmd
This is our output

$ my next command

versus

$ torus cmd
This is our output
$ my next command

jeffandersen avatar Dec 12 '16 17:12 jeffandersen

I prefer the latter, new line after output. But that's just because I like whitespace and it distinguishes nicely between the last command.

ntassone avatar Dec 12 '16 20:12 ntassone

I'm against vertical whitespace immediately following entering the command, and after the output of the command:

  • its not common (but not important enough to break the mold for), so its off-putting
  • if someone likes whitespace before their prompt, they can set their prompt to include it

whitespace is perfectly fine within the body of the output to delimit things.

jbowes avatar Dec 12 '16 23:12 jbowes

Tabwriter/table spacing should be 8

on an 80 column width terminal, that's quite a lot. how about 4 instead?

if there's more horizontal space than is required, should we increase that width to try and fill the screen?

jbowes avatar Dec 12 '16 23:12 jbowes

We can easily determine the window size on execution, and wrap text accordingly. This means that all the other elements (tables, lists, errors etc) should obey this too.

when wrapping, or in general, should we leave some whitespace at the edge of the screen? I'm partial to leaving 1 or 2 chars.

Something that's tricky with wrapping the cells in tables is how do you decide which cell to wrap, and how much? I guess we build a new layout engine ;)

jbowes avatar Dec 12 '16 23:12 jbowes

on an 80 column width terminal, that's quite a lot. how about 4 instead?

sure I was just drawing on what seemed to be used now, but we can reduce it.

jeffandersen avatar Dec 13 '16 12:12 jeffandersen

I guess we build a new layout engine ;)

Yeah i was thinking about that when writing that bit. It's tricky, but sometimes you just know that a particular column contains bulky output and would be smart to wrap... but then you get into how to implement that sanely.. for which a new layout engine might be needed.

jeffandersen avatar Dec 13 '16 12:12 jeffandersen

I'm against vertical whitespace immediately following...

@jbowes I'll defer to you and standard formatting on this one. We should adhere to the standards for this kind of stuff as much as possible.

ntassone avatar Dec 13 '16 17:12 ntassone