diff options
| -rw-r--r-- | adjmix/Adjmix.hs | 7 | ||||
| -rw-r--r-- | trivmix.cabal | 3 | ||||
| -rw-r--r-- | trivmix.nix | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/adjmix/Adjmix.hs b/adjmix/Adjmix.hs index 645ac6a..94416ac 100644 --- a/adjmix/Adjmix.hs +++ b/adjmix/Adjmix.hs | |||
| @@ -3,6 +3,7 @@ | |||
| 3 | import Options.Applicative | 3 | import Options.Applicative |
| 4 | 4 | ||
| 5 | import System.FilePath | 5 | import System.FilePath |
| 6 | import System.FileLock | ||
| 6 | 7 | ||
| 7 | import Data.Char | 8 | import Data.Char |
| 8 | 9 | ||
| @@ -20,6 +21,7 @@ optionParser = Options | |||
| 20 | <> metavar "DIRECTORY" | 21 | <> metavar "DIRECTORY" |
| 21 | <> value "/dev/shm/mix" | 22 | <> value "/dev/shm/mix" |
| 22 | <> showDefault | 23 | <> showDefault |
| 24 | <> help "Base directory" | ||
| 23 | ) | 25 | ) |
| 24 | <*> strOption ( long "target" | 26 | <*> strOption ( long "target" |
| 25 | <> short 't' | 27 | <> short 't' |
| @@ -35,16 +37,19 @@ optionParser = Options | |||
| 35 | <*> ( ( Set <$> option auto ( long "set" | 37 | <*> ( ( Set <$> option auto ( long "set" |
| 36 | <> short 'o' | 38 | <> short 'o' |
| 37 | <> metavar "LEVEL" | 39 | <> metavar "LEVEL" |
| 40 | <> help "Overwrite the current level" | ||
| 38 | ) | 41 | ) |
| 39 | ) | 42 | ) |
| 40 | <|> ( Add <$> option auto ( long "add" | 43 | <|> ( Add <$> option auto ( long "add" |
| 41 | <> short 'a' | 44 | <> short 'a' |
| 42 | <> metavar "LEVEL" | 45 | <> metavar "LEVEL" |
| 46 | <> help "Add to the current level" | ||
| 43 | ) | 47 | ) |
| 44 | ) | 48 | ) |
| 45 | <|> ( Sub <$> option auto ( long "sub" | 49 | <|> ( Sub <$> option auto ( long "sub" |
| 46 | <> short 's' | 50 | <> short 's' |
| 47 | <> metavar "LEVEL" | 51 | <> metavar "LEVEL" |
| 52 | <> help "Subtract from the current level" | ||
| 48 | ) | 53 | ) |
| 49 | ) | 54 | ) |
| 50 | ) | 55 | ) |
| @@ -59,7 +64,7 @@ main = execParser opts >>= adjmix | |||
| 59 | ) | 64 | ) |
| 60 | 65 | ||
| 61 | adjmix :: Options -> IO () | 66 | adjmix :: Options -> IO () |
| 62 | adjmix Options{..} = do | 67 | adjmix Options{..} = withFileLock levelFile' Exclusive $ const $ do |
| 63 | oldLevel <- readFile levelFile' >>= readIO . stripSpace | 68 | oldLevel <- readFile levelFile' >>= readIO . stripSpace |
| 64 | let | 69 | let |
| 65 | newLevel = oldLevel `doAdjustment` adjustment | 70 | newLevel = oldLevel `doAdjustment` adjustment |
diff --git a/trivmix.cabal b/trivmix.cabal index 803c640..54aad76 100644 --- a/trivmix.cabal +++ b/trivmix.cabal | |||
| @@ -2,7 +2,7 @@ | |||
| 2 | -- documentation, see http://haskell.org/cabal/users-guide/ | 2 | -- documentation, see http://haskell.org/cabal/users-guide/ |
| 3 | 3 | ||
| 4 | name: trivmix | 4 | name: trivmix |
| 5 | version: 2.5.2 | 5 | version: 2.5.3 |
| 6 | -- synopsis: | 6 | -- synopsis: |
| 7 | -- description: | 7 | -- description: |
| 8 | license: PublicDomain | 8 | license: PublicDomain |
| @@ -48,6 +48,7 @@ executable adjmix | |||
| 48 | build-depends: base >=4.7 && <4.8 | 48 | build-depends: base >=4.7 && <4.8 |
| 49 | , optparse-applicative >=0.11 && <1 | 49 | , optparse-applicative >=0.11 && <1 |
| 50 | , filepath >=1.3 && <2 | 50 | , filepath >=1.3 && <2 |
| 51 | , filelock >=0.1 && <1 | ||
| 51 | , trivmix | 52 | , trivmix |
| 52 | hs-source-dirs: adjmix | 53 | hs-source-dirs: adjmix |
| 53 | default-language: Haskell2010 | 54 | default-language: Haskell2010 |
diff --git a/trivmix.nix b/trivmix.nix index 298174b..d29bb48 100644 --- a/trivmix.nix +++ b/trivmix.nix | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | cabal.mkDerivation (self: { | 7 | cabal.mkDerivation (self: { |
| 8 | pname = "trivmix"; | 8 | pname = "trivmix"; |
| 9 | version = "2.5.2"; | 9 | version = "2.5.3"; |
| 10 | src = ./.; | 10 | src = ./.; |
| 11 | isLibrary = true; | 11 | isLibrary = true; |
| 12 | isExecutable = true; | 12 | isExecutable = true; |
