-
Notifications
You must be signed in to change notification settings - Fork 169
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
feat: Formatter #241
feat: Formatter #241
Conversation
Adds a `tk fmt` command that basically exposes what's know as `jsonnetfmt`: A formatter for Jsonnet. Did some work around actually finding files to format, think it looks good. Semantics: - only works on `.jsonnet` and `.libsonnet`, unless specified explicitely - ignores hidden files, and `vendor` - `tk fmt <directory>`: reformat every jsonnet file recursively - `tk fmt <file>`: reformat that file - `tk fmt --inplace=false`: print to stdout instead of writing - `tk fmt --test`: exit with non-zero in case of differences. Does not touch files
I tried this on an un-linted Jsonnet codebase. Running |
Added some more bad usage handling and a verbose mode:
|
Makes init properly format the k.libsonnet it creates
Improves the experience of using `tk fmt` by providing better output: - notice how many files were formatted - notice if nothing has been done
ping @malcolmholmes @rfratto, had success using this the last week, sb wanna approve? |
Completion: |
This shouldn't block, but the thing that is missing for me is a "lint diff". i.e. show me what you would change. |
upgrades go-clix to v0.1.1
because |
Changes from sh0rez/go-jsonnet are merged in upstream now
Adds a
tk fmt
command that basically exposes what's know asjsonnetfmt
: A formatter for Jsonnet.Did some work around actually finding files to format, think it looks good.
Semantics:
.jsonnet
and.libsonnet
, unless specified explicitelyvendor
tk fmt <directory>
: reformat every jsonnet file recursivelytk fmt <file>
: reformat that filetk fmt --stdout
: print to stdout instead of writing to disktk fmt --test
: exit with non-zero in case of differences. Does nottouch files