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

Right-alignment #165

Open
alex-ozdemir opened this issue Jan 25, 2019 · 1 comment · Fixed by jqnatividad/qsv#34 · May be fixed by #209
Open

Right-alignment #165

alex-ozdemir opened this issue Jan 25, 2019 · 1 comment · Fixed by jqnatividad/qsv#34 · May be fixed by #209

Comments

@alex-ozdemir
Copy link

Hey there!

What do you think of having an option to right-align the text within a cell? This is nice when it comes to viewing numbers, since it aligns digits of the same place.

I imagine this would require the API of the elastic tabstops package to be expanded.

I'm happy to do this myself, I just wanted to check in and see whether you'd support it first.

Cheers,
Alex

@BurntSushi
Copy link
Owner

In theory, yes. We can leave this issue open, but it would be good to spec out an API on the tabwriter project first. This may be a bit hairy to implement, but I'm definitely open to adding more options to tabwriter.

tabwriter was inspired by Go's package by the same name, which does indeed support right alignment.

alex-ozdemir added a commit to alex-ozdemir/xsv that referenced this issue Feb 21, 2020
This flag allows the user to specify how data should be aligned within
columns. The options are:

   * left
   * right
   * center

This alignment is applied to all columns.

Per the tabwriter crate, center alignment breaks ties in favor of being
closer to the left. Thus if "hi" appears in a column of width 5, it will
be printed as " hi  ".

resolves BurntSushi#165.
@alex-ozdemir alex-ozdemir linked a pull request Feb 21, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants