1 {-# LANGUAGE AllowAmbiguousTypes #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE NoMonomorphismRestriction #-}
4 {-# LANGUAGE TypeApplications #-}
5 {-# LANGUAGE NamedFieldPuns #-}
6 {-# LANGUAGE UndecidableInstances #-}
7 {-# OPTIONS_GHC -Wno-missing-signatures #-}
8 {-# OPTIONS_GHC -Wno-unused-imports #-}
9 module Hjugement.CLI where
11 import Control.Applicative (Applicative(..), Alternative(..))
12 import Control.Monad (Monad(..))
14 import Data.Either (Either(..))
15 import Data.Function (($), (.))
16 import Data.Functor ((<$>), (<$))
18 import Data.List.NonEmpty (NonEmpty(..))
19 import Data.Maybe (Maybe(..), fromMaybe)
20 import Data.Ord (Ord(..))
21 import Data.Semigroup (Semigroup(..))
22 import Data.String (String)
23 import Data.Text (Text)
24 import Data.Void (Void)
25 import Symantic.CLI as CLI
26 import System.Environment (getArgs)
27 import System.IO (IO, FilePath, print, stderr, putStrLn)
28 import Text.Show (Show(..))
29 import Type.Reflection (Typeable)
30 import qualified Data.Set as Set
31 import qualified Data.Text as Text
32 import qualified Data.Text.Lazy.IO as TL
33 import qualified Data.Version as Version
34 import qualified Paths_hjugement_cli as Hjugement
35 import qualified Symantic.Document as Doc
36 import qualified System.IO as IO
38 import Hjugement.CLI.Utils
39 import Hjugement.CLI.Registrar
40 import Hjugement.CLI.Trustee
41 import Hjugement.CLI.MkElection
44 progname = "hjugement"
48 Text.pack (Version.showVersion Hjugement.version)
52 (api_options <?> api_command) <!>
62 run_registrar opts :!:
64 (run_mkelection :!: run_help api_mkelection)
69 tagged (TagLong "version") nothing
72 parseAPI = parser @Void @Doc api $
78 return (Doc.from version <> Doc.newline)