dmyTRUEk / gensoquote

Gensokyo Quotes
MIT License
2 stars 0 forks source link

Formatting suggestions #2

Closed kojq closed 5 months ago

kojq commented 5 months ago

These could be flags/configs or just general changes:

dmyTRUEk commented 5 months ago
  1. author text is right-justified
  2. choose justification of the quote and author

What exactly do you mean by this? Could you please give an example? If that is just "simple normal" text justification as in any GUI, then i think it's impossible, because program operates in "cli mode" and therefore (i think) can't even know terminal's size.

  1. newline between quote and author
  2. option to remove author
  3. option to remove quotation marks from quotes
  4. option to wrap after, for example, a certain number of characters

Yes, i agree, this is very good QOL feature, and i'm planning to implement it in the nearest future. All of the above should be easily achievable with proper formatting option, maybe something like this:

kojq commented 5 months ago
  1. If you look at fortune, the author text is right-justified (it seems a certain number of spaces are simply added to give that look).

  2. This is the same thing, but applied to all text.

6) Wrap meaning after "x" number of words, a put the remaining text on the next line for each line.

kojq commented 5 months ago

Example for 1

Ninety percent of the time things turn out worse than you thought they would.
The other ten percent of the time you had no right to expect that much.
        -- Augustine

Example for 2

             Ninety percent of the time things turn out worse than you thought they would.
             The other ten percent of the time you had no right to expect that much.
                              -- Augustine

Example for 6

             Ninety percent of the time things turn
             out worse than you thought they would.
             The other ten percent of the time you
             had no right to expect that much.
                              -- Augustine
kojq commented 5 months ago

Also, unlike fortune, could we have em dash (—) for quote attribution instead?

dmyTRUEk commented 5 months ago

Also, unlike fortune, could we have em dash (—) for quote attribution instead?

Yeah, sure, i think this could be an option. Or as a more general solution it would be possible to change it using formatting option.

dmyTRUEk commented 5 months ago

I see what you mean by justifying and wrapping. Probably will do after formatting option.

dmyTRUEk commented 5 months ago
  • newline between quote and author
  • option to remove author
  • option to remove quotation marks from quotes

Done via feat: format option (26eb35c)

dmyTRUEk commented 5 months ago
  • option to wrap after, for example, a certain number of characters

As it turns out there is just right command from GNU coreutils that does exactly that: fmt.

So you can do gensoquote | fmt -s -w 40, and it will be wrapped after 40 characters.

  • author text is right-justified

  • choose justification of the quote and author

As for these, it can be achieved by

  1. Using format option to indent quote's author, for example like this:
    gensoquote -f '"%q"\n -- %c( to %t)( about %a), "%s"'
  2. (optional) Wrap lines at some number of characters using fmt
  3. Shift every line of the output by some number of spaces using awk, sed, python or any other utility, for example to shift by 10 spaces:
    gensoquote | awk '{ printf "%20s%s\n", "", $0 }'
    gensoquote | sed 's/^/ /'
    gensoquote | python3 -c "import sys; [print(' '*10 + line, end='') for line in sys.stdin]"

For the ultimate result, combine them to whatever your liking is ;)