Consider adding --inplace
option #40
Labels
No Label
blocked: dependency
blocked: info-needed
bug
duplicate
enhancement
fixed in HEAD
help wanted
hs:arrows
hs:brackets
hs:classes
hs:comments
hs:do-notation
hs:guards
hs:lists
hs:operators
hs:patterns
hs:records
hs:types
invalid
language extension support
layouting
needs confirmation
priority: high
priority: low
question
revisit before next release
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: hexagoxel/brittany#40
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
Usage:
And since input files can already be specified as positional arguments, the
-i
parameter could be reassigned as shortcut for--inplace
...(My current workaround:
ls **/*.hs | xargs -I{} brittany -i {} -o {}
)good point.
thinking aloud a bit:
[FILE..]
and not just[FILE]
, so just quickly aliasing--inplace x
to--input x --output x
is not sufficient. (A great reason for me to refactor the monstrosity that is the effectivemain
function. whistles innocently)PR #59 adds an
--inplace
flag, but due to limitations of thebutcher
library thebrittany --inplace **/*.hs
usecase does not work yet. I'll fix that inbutcher
next.I have uploaded
butcher-1.1.1.0
which hasaddStringParams
.@d-dorazio you wanna do the final bit to fix this?
@lspitzner sure, but I also have a proposal: specifying input files both with
-i
and as parameters seem a bit verbose to me so I'd remove both-i
and-o
and provide an interface similar to what other formatters provide likerustfmt
. For example we could add--write-mode inplace|display
and the files would be specified only as parameters. In particular, the--write-mode
allows to eventually support other formats such asdiff
.@d-dorazio I agree, the current handling of
--input
vs param(s) can be improved, andwrite-mode
makes sense. I don't see the verbosity argument - it only affects the (commandline) docs, but I have no strong opinion on this.For clarification:
--write-mode
zipWithM
Strongly in favour of 0 and 1, even if 1 is a breaking change due to implying
--inplace
. Slightly in favour of keeping support for 2/3/4. I can do without 5 and 6 (i.e. make param(s) and-i
/-o
incompatible).There is one other related item: Do we want to support
brittany Foo.hs Bar.hs --flagA --flagB
? And if not, warn about interpreting--flagA
as a file name? The best solution probably is to stop supporting file names start with a dash and then allow reordering for params as well. I'll have to make anotherbutcher
release for that, whoops. That's what I get for not usingoptparse-applicative
:D@lspitzner 1 and 2 look unintuitive to me, because I see
params
as basically equivalent to--inputs
. I think that an interface like the following would be simpler and wouldn't provide ambiguities:It's true that you'd lose the ability to specify different output files than the input. I think it doesn't happen very often and you can always just redirect the output to the custom output.
If you feel strongly about it then I can implement it the other way though.
@d-dorazio what ambiguities? what you suggest there is farther from the
rustfmt
behaviour as you make--write-mode display
the default; not that i am strictly opposed to this, but it seems to be the only difference between our suggestions.