nimpretty --margin=0 # means infinity (ie no line wrap); can pass any integer, eg 80, 120...nimpretty --maxLineLen:Nnimpretty --fixcase=true # when true, changes case of identifiers to same case as symbol declaration, eg: splitlines will become splitLines because symbol declared as splitLinesnimpretty --safe # this one runs a subset of all transformations run by nimpretty that is known to work (eg, not break code)git nimpretty to only consider style violations local to PR diff. Note that it should be a warning, not an error (eg when a PR has to move a block of code and it may be undesirable to nimpretty it for whatever reason, or if running nimpretty would somehow result in broken code due to a bug in nimpretty)nimpretty --tabwidth=2 # when set, changes tab width to requested value (useful when some source code uses tab width inconsistent with other code in a project)nimpretty --indent:NInstead of --tabwidth you can fix the source file so that the first indentation uses the desired number of spaces. --margin is a bit against nimpretty's "zero configuration" philophy too. --fixcase will be though to support. ;-)
fixcase should instead support user-configurable styles (snake_case, camelCase, ...) at file and whole-project granularity
(moved from top-post for easy individual reference wo creating a new issue)
nimpretty --difflines:commit which is the exact analog of git clang-format which only applies formatting on lines that appear in the diff wrt commit This is very useful to apply formatting changes without creating un-necessary large diffsnimpretty changes its output over time; and it will)Would it be possible to add support for stdin to stdout to nimpretty?
nimpretty - should read from stdin and write to stdout.
Also, nimpretty makes a mess of json %* macro code.
Also, nimpretty makes a mess of json %* macro code.
Can you please post an example (as a separate issue, ideally), because I was not able to reproduce the mess you mention?
@narimiran , see #11937.
Would it be possible to add support for stdin to stdout to nimpretty?
nimpretty -should read from stdin and write to stdout.
To compound this problem shell process substitution is broken because nimpretty renames input filepaths not ending in ".nim": nimpretty --out:/dev/stdout <(cat)
And complains cannot open /dev/fd/45.nim
Or /dev/stdin -> /dev/stdin.nim, for that matter.
nimfmt now implements a feature to fix casing with user-configurable parameters
nimpretty's --maxLineLen option addresses the first point of this Issue (I updated the issue accordingly)
Most helpful comment
Would it be possible to add support for stdin to stdout to nimpretty?
nimpretty -should read from stdin and write to stdout.