on master help sign in
Add ‘-i’ as a shortcut for ‘--mode inplace’
commite5bbfddfa3cc04a17ce1b634cbfd8f425e4ccdc9 authorMark Karpov <markkarpov92@gmail.com> dateFri 26 Jun 2020, 10:51 (6 years ago) parente29dd2b
2 files changed+16−7
CHANGELOG.md+3 app/Main.hs+13−7
CHANGELOG.md+3
@@ -3,6 +3,9 @@
33* Fixed the bug when comments in different styles got glued together after
44 formatting. [Issue 589](https://github.com/tweag/ormolu/issues/589).
55
6+* Added `-i` as a shortcut for `--mode inplace`. [Issue
7+ 467](https://github.com/tweag/ormolu/issues/467).
8+
69## Ormolu 0.1.1.0
710
811* Imports in a import lists are now normalized: duplicate imports are
app/Main.hs+13−7
@@ -8,6 +8,7 @@ module Main (main) where
88
99import Control.Exception (SomeException, displayException, try)
1010import Control.Monad
11+import Data.Bool (bool)
1112import Data.Either (lefts)
1213import Data.List (intercalate, sort)
1314import qualified Data.Text.IO as TIO
@@ -134,13 +135,18 @@ optsParserInfo =
134135optsParser :: Parser Opts
135136optsParser =
136137 Opts
137− <$> (option parseMode . mconcat)
138− [ long "mode",
139− short 'm',
140− metavar "MODE",
141− value Stdout,
142− help "Mode of operation: 'stdout' (default), 'inplace', or 'check'"
143− ]
138+ <$> ( (fmap (bool Stdout InPlace) . switch . mconcat)
139+ [ short 'i',
140+ help "A shortcut for --mode inplace"
141+ ]
142+ <|> (option parseMode . mconcat)
143+ [ long "mode",
144+ short 'm',
145+ metavar "MODE",
146+ value Stdout,
147+ help "Mode of operation: 'stdout' (default), 'inplace', or 'check'"
148+ ]
149+ )
144150 <*> configParser
145151 <*> (many . strArgument . mconcat)
146152 [ metavar "FILE",