Skip to content

schvabodka-man/formatter-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

What is this?

The simple CLI util to help you make proper formatting of any human-language string. For example, you input "the quick brown fox ,jumps Over The , lazy dog ... " and get "The quick brown fox, jumps over the, lazy dog...". Magic!

asciicast

Provided functionality

Primary stuff

  • "Smart" regex based word casing.
  • Formatting of quotes
  • Formatting of commas, semilocons, etc.
  • Proper spacing for everything

Secondary stuff

  • Fancy diff with colorization
  • Possibility to set your own ansi codes/chars for diff
  • Mode for interactive input instead of cli

The code

Pretty neat stuff, the core logics is in fact purely functional.

CLI params

  • -an,--ansi-new Ansi char for new stuff in diff
  • -ao,--ansi-old Ansi char for old stuff in diff
  • -c,--color Colorize output
  • -cn,--char-new Char to show for new stuff in diff
  • -co,--char-old Char to show for old stuff in diff
  • -d,--diff Show diff
  • -h,--help Help
  • -i,--interactive Run app interactively
  • -s,--string Input string, this one is REQUIRED.

What's used?

Apache Commons libraries(mostly for cli interface), jansi for coloring diffs and diffutils that's it. There is also Junit tests. No bloat.

Why Java? This stuff should be written on C/Python/Go

The performance overhead for that small application isn't really that bad at all.

Probable improvements

I really don't know what you can improve. Maybe some dictionary based upcasing and support for different languages(the current version of app won't obliviously work with chineese/japanese/hebrew/arabic/hindi rules of punctuation, only latin/cyrillic-alphabet european languages)? Anyway i would be glad to see some PR.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages