Commit Graph

65 Commits (c59655f10d5ad295c2481537fc8abf0a297d9d1c)

Author SHA1 Message Date
Soares Chen 8778dcf2f4 Create Main module for Brittany 2020-04-06 12:03:46 +00:00
Lennart Spitzner 85d55c3768 Print paths of files that would change with --check-mode 2020-02-07 20:03:56 +01:00
Lennart Spitzner 03e2b62c24 Introduce flag to disable formatting per-module
New inline config `-- brittany-disable` that parses but
ignores the current module. Useful if both brittany
and ghc-exactprint bug out for some syntax.
2020-01-23 13:56:25 +01:00
Lennart Spitzner d0256bb0db Make unknown syntax errors non-fatal/Fall back on exactprint 2020-01-03 11:58:53 +01:00
Lennart Spitzner 342cf16c56 Improve error message printing
- Omit unnecessary show-invocation
- Use showOutputable for the error span (location)

before/after:

  "RealSrcSpan SrcSpanPoint \"stdin\" 2 1: parse error (possibly incorrect indentation or mismatched brackets)"
  stdin:2:1: parse error (possibly incorrect indentation or mismatched brackets)
2020-01-03 11:58:53 +01:00
Lennart Spitzner 4de2862a04 Add commandline flag --no-user-config
Stops brittany from trying to read a user-global config
flag. Together with --config-file, this can be used to pass
one single config to brittany, thereby controlling exactly
and explicit what the inputs of brittany are.
Should be useful for testing stuff that might depend on
config.
2019-08-28 14:23:33 +02:00
Lennart Spitzner 033fdc6517 Apply brittany to Main.hs 2019-08-28 14:23:33 +02:00
Lennart Spitzner bd10c3c4ef Update copyright in commandline notices 2019-08-28 14:23:33 +02:00
Lennart Spitzner 37e4225c49 Include exact location when printing ErrorUnknownNode 2018-09-18 00:23:23 +02:00
5outh b2795482fa Append input path name to UnknownNode errors 2018-09-17 14:32:20 -04:00
Doug Beardsley 3729a57196 Add check mode for use by test suites
This mode makes no changes to files, but returns 0 (success) when no
changes would be made and 1 (failure) when changes would be made.
2018-09-11 01:25:35 -04:00
Lennart Spitzner 6725d0e119 Refactor/Auto-format Main, Brittany.Internal 2018-06-04 17:10:10 +02:00
Lennart Spitzner 57c48f64c1 Apply inline config to module header (fixes #151) 2018-06-04 16:57:07 +02:00
Lennart Spitzner a237e591b2 Implement `--obfuscate`
Support replacing all (non-keyword) identifiers with
randomly generated characters
2018-04-24 00:47:50 +02:00
Lennart Spitzner 18704e403f Fix inline disabling of brittany 2018-04-19 17:09:10 +02:00
Lennart Spitzner e559a2cbf7 Implement inline configuration
e.g. "-- brittany --indent=4"

respects the following comment forms as input:

  source comment                       affected target
  ======================================================
  "-- brittany CONFIG"                 whole module
  "-- brittany-next-binding CONFIG"    next binding
  "-- brittany-disable-next-binding"   next binding
  "-- brittany @ myExampleFunc CONFIG" `myExampleFunc`

multiline-comments are supported too, although
the specification must still be a single line. E.g.

  "{- brittany --columns 50 -}"

CONFIG is either:

  1) one or more flags in the form of what brittany accepts
     on the commandline, e.g. "-- columns 50", or
  2) one or more specifications in the form of what brittany
     accepts in its config files for the layouting config
     (a one-line yaml document), e.g. "{ lconfig_cols: 50 }"

see #30
2018-04-17 20:04:40 +02:00
Lennart Spitzner e79af18fb6 Omit file write if file is unchanged (fixes #93) 2018-04-09 00:29:58 +02:00
Lennart Spitzner 62d066d496 Un-ignore coreIO error-numbers when processing one file only 2018-04-05 21:05:19 +02:00
Sergey Vinokurov e9689394b1
Add Semigroup instance for 'Max' monoid
Otherwise ghc 8.4 will complain since Semigroup became a superclass
of Monoid.
2018-04-02 21:25:43 +01:00
Lennart Spitzner 8cabd08477 Update README.md and commandline description 2018-03-25 16:06:36 +02:00
alexeyraga 83b39de3d4 Expose readConfigs 2018-03-07 21:56:52 +11:00
Lennart Spitzner 4b53072ccd Correct some commandline help output 2018-02-14 17:18:15 +01:00
Lennart Spitzner d749c0da27 Prevent crash if ~/.config does not exist (fixes #115) 2018-02-13 20:06:31 +01:00
Lennart Spitzner 8430b74b1a Switch to butcher-1.3, Improve help layout, fixes #103 2018-02-13 20:05:48 +01:00
Erik Schnetter b46f9dd23b
Correct wording of warning message
"certain" -> "some"
2018-01-15 18:11:50 -05:00
Lennart Spitzner e788ac9afd Minor fixup in Main.hs for next butcher release 2018-01-13 18:31:39 +01:00
Lennart Spitzner c709513209 Remove dependency on either package
Following the deprecation and removal of the EitherT transformer
2017-11-27 18:11:49 +01:00
Lennart Spitzner 7d7ec3e8b4 Update commandline help output 2017-10-04 23:43:30 +02:00
d-dorazio 752048882e move inputParams into the reordered block 2017-10-04 20:56:37 +02:00
d-dorazio f21c6b6eac rework the cli interface 2017-10-03 23:32:36 +02:00
Lennart Spitzner bb40870f81 Merge pull request #59 from d-dorazio/master 2017-10-02 14:13:27 +02:00
d-dorazio 95c40f2b1e address review comments 2017-10-02 13:55:52 +02:00
d-dorazio 36af16f881 add inplace flag 2017-10-01 17:04:20 +02:00
d-dorazio 308da71afb support multiple inputs and outputs 2017-10-01 17:04:20 +02:00
Lennart Spitzner a348ae7fbc Switch to XDG path for config; Search conf in parents
- switch to XDG path should be backwards-compatible:
  - new config will be written to XDG path
  - but existing config in ~/.brittany will be respected
- looks for "brittany.yaml" not only in cwd, but in parents too.
  uses the first file found.

fixes #45, fixes #55
2017-09-29 21:42:39 +02:00
Lennart Spitzner 9703ebead5 Fix #53
Previously, if the input did not end with a newline
character and config had 'ppconf_hackAroundIncludes = True'
then due to using unlines/lines the output contained an
additional newline.
2017-09-10 16:37:35 +02:00
Lennart Spitzner b0f211fbfc Add/Use flag `-h` for `--help`, fixes #44 2017-08-10 17:46:21 +02:00
Lennart Spitzner 08e94f0e74 Differentiate ErrNos 2017-08-08 00:47:04 +02:00
Lennart Spitzner 69c50bebd3 Refactor Main.hs in preparation of --inplace (see #40) 2017-08-08 00:46:09 +02:00
Lennart Spitzner 16f5aa118d Add flag to omit reformatting (ghc-exactprint only) 2017-06-03 21:01:24 +02:00
Lennart Spitzner 8443988af3 Change help text 2017-06-03 18:23:03 +02:00
Lennart Spitzner 9f4cda9130 Add license (AGPLv3) 2017-06-03 18:23:03 +02:00
Lennart Spitzner dfec26e55b Refactor/Rename LayoutError -> BrittanyError 2017-06-03 18:23:03 +02:00
Lennart Spitzner f350113f7f Refactor all modules: +Internal; Add public Brittany module 2017-05-22 21:25:08 +02:00
Lennart Spitzner 5dbe0f2c9c Add function pureModuleTransform 2017-05-22 21:06:02 +02:00
Lennart Spitzner 72c87b7b4e Auto-reformat Main.hs 2017-05-22 15:58:04 +02:00
Lennart Spitzner fd9427754e Add "hackAroundIncludes" option (default false)
- Makes brittany work in stdin/stdout mode when
  CPP usage is limited to #includes.
2017-05-22 15:49:18 +02:00
Lennart Spitzner 8f1e366f9c Change config file structure; Add config version tag 2017-05-21 16:48:05 +02:00
Lennart Spitzner 296629b96c Update README.md (installation); Fix copyright notice 2017-05-17 23:31:20 +02:00
Lennart Spitzner 68e77c9337 Fixup for czipwith and Update stack.yaml 2017-05-14 19:32:31 +02:00