From dd96957c4cc5b49261cb81c4dc871bb6bbb40132 Mon Sep 17 00:00:00 2001 From: Liang-Ting Chen Date: Mon, 14 Oct 2019 17:14:58 +0100 Subject: [PATCH] Rename the package to fix-whitespace --- FixWhitespace.hs | 15 ++++++++------- ...agda-whitespace.cabal => fix-whitespace.cabal | 16 +++++++++++++--- fix-agda-whitespace.yaml => fix-whitespace.yaml | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) rename fix-agda-whitespace.cabal => fix-whitespace.cabal (50%) rename fix-agda-whitespace.yaml => fix-whitespace.yaml (95%) diff --git a/FixWhitespace.hs b/FixWhitespace.hs index edfe89f..61242c3 100644 --- a/FixWhitespace.hs +++ b/FixWhitespace.hs @@ -1,7 +1,7 @@ -- Liang-Ting Chen 2019-10-13: -- this program is partially re-written such that -- the configuration part is controllfed by an external --- configuration file `fix-agda-whitespace.yaml" +-- configuration file `fix-whitespace.yaml" -- in the base directory instead. import Control.Monad @@ -23,7 +23,7 @@ import ParseConfig -- The location of the configuration file. -- TODO: Add an option to specify a custom location. defaultLoc :: FilePath -defaultLoc = "fix-agda-whitespace.yaml" +defaultLoc = "fix-whitespace.yaml" -- Modes. @@ -35,10 +35,11 @@ data Mode main :: IO () main = do args <- getArgs + progName <- getProgName mode <- case args of [] -> return Fix ["--check"] -> return Check - _ -> hPutStr stderr usage >> exitFailure + _ -> hPutStr stderr (usage progName) >> exitFailure Config incDirs excDirs incFiles excFiles <- parseConfig defaultLoc base <- getCurrentDirectory @@ -50,11 +51,11 @@ main = do -- | Usage info. -usage :: String -usage = unlines - [ "fix-agda-whitespace: Fixes whitespace issues." +usage :: String -> String +usage progName = unlines + [ progName ++ ": Fixes whitespace issues." , "" - , "Usage: fix-agda-whitespace [--check]" + , "Usage: " ++ progName ++ " [--check]" , "" , "This program should be run in the base directory." , "" diff --git a/fix-agda-whitespace.cabal b/fix-whitespace.cabal similarity index 50% rename from fix-agda-whitespace.cabal rename to fix-whitespace.cabal index babda7b..fb9c2d8 100644 --- a/fix-agda-whitespace.cabal +++ b/fix-whitespace.cabal @@ -1,14 +1,24 @@ -name: fix-agda-whitespace +name: fix-whitespace version: 0.0.5 cabal-version: >= 1.8 build-type: Simple -description: Fixes whitespace issues for Agda sources. +description: Removes trailing whitespace, lines containing only whitespace and ensure that every file ends in a newline character. +maintainer: Liang-Ting Chen +homepage: https://github.com/agda/fix-whitespace +bug-reports: https://github.com/agda/fix-whitespace/issues +author: fix-whitespace was originally rewritten by Nils Anders Danielsson with contributions from Ulf Norell, Andrés Sicard-Ramírez, Andreas Abel, Philipp Hausmann, Jesper Cockx, Vlad Semenov, and Liang-Ting Chen. +Category: Text +Synopsis: Fixes whitespace issues. tested-with: GHC == 8.0.2 GHC == 8.2.2 GHC == 8.4.4 GHC == 8.6.5 -executable fix-agda-whitespace +source-repository head + type: git + location: https://github.com/agda/fix-whitespace.git + +executable fix-whitespace hs-source-dirs: . main-is: FixWhitespace.hs other-modules: ParseConfig diff --git a/fix-agda-whitespace.yaml b/fix-whitespace.yaml similarity index 95% rename from fix-agda-whitespace.yaml rename to fix-whitespace.yaml index 1734ad2..7121724 100644 --- a/fix-agda-whitespace.yaml +++ b/fix-whitespace.yaml @@ -1,4 +1,4 @@ -# fix-agda-whitespace determines the set of directories first and +# fix-whitespace determines the set of directories first and # then the set of filenames inside those directories. # # The extended glob pattern can be used to specify file/direcotory names.