@@ -112,23 +112,12 @@ defaultOptions = Options {
112
112
113
113
options :: [OptDescr (Options -> Options )]
114
114
options = [
115
- Option [' v' , ' V' ] [" version" ]
116
- (NoArg (\ opts -> opts {optShowVersion = True }))
117
- " show version number" ,
118
115
Option [' h' , ' ?' ] [" help" ]
119
116
(NoArg (\ opts -> opts {optShowHelp = True }))
120
117
" show usage information" ,
121
- Option [' T' ] [" tsv" ]
122
- (NoArg (\ opts -> opts {optTsvOutput = True }))
123
- " output in tsv format" ,
124
- Option [' e' ] [" eval" ]
125
- (ReqArg (\ expr opts -> opts {optEvalString = Just expr})
126
- " String" )
127
- " eval the argument string" ,
128
- Option [' c' ] [" command" ]
129
- (ReqArg (\ expr opts -> opts {optExecuteString = Just expr})
130
- " String" )
131
- " execute the argument string" ,
118
+ Option [' v' , ' V' ] [" version" ]
119
+ (NoArg (\ opts -> opts {optShowVersion = True }))
120
+ " show version number" ,
132
121
Option [' L' ] [" load-library" ]
133
122
(ReqArg (\ d opts -> opts {optLoadLibs = optLoadLibs opts ++ [d]})
134
123
" [String]" )
@@ -140,16 +129,24 @@ options = [
140
129
Option [] [" no-io" ]
141
130
(NoArg (\ opts -> opts {optNoIO = True }))
142
131
" prohibit all io primitives" ,
132
+ Option [' p' ] [" prompt" ]
133
+ (ReqArg (\ prompt opts -> opts {optPrompt = prompt})
134
+ " String" )
135
+ " set prompt string" ,
143
136
Option [] [" no-banner" ]
144
137
(NoArg (\ opts -> opts {optShowBanner = False }))
145
138
" do not display banner" ,
146
139
Option [' t' ] [" test" ]
147
140
(NoArg (\ opts -> opts {optTestOnly = True }))
148
141
" execute only test expressions" ,
149
- Option [' p ' ] [" prompt " ]
150
- (ReqArg (\ prompt opts -> opts {optPrompt = prompt })
142
+ Option [' e ' ] [" eval " ]
143
+ (ReqArg (\ expr opts -> opts {optEvalString = Just expr })
151
144
" String" )
152
- " set prompt string" ,
145
+ " eval the argument string" ,
146
+ Option [' c' ] [" command" ]
147
+ (ReqArg (\ expr opts -> opts {optExecuteString = Just expr})
148
+ " String" )
149
+ " execute the argument string" ,
153
150
Option [' s' ] [" substitute" ]
154
151
(ReqArg (\ expr opts -> opts {optSubstituteString = Just expr})
155
152
" String" )
@@ -162,6 +159,9 @@ options = [
162
159
(ReqArg (\ expr opts -> opts {optSubstituteString = Just (" (filter " ++ expr ++ " $)" )})
163
160
" String" )
164
161
" filter strings" ,
162
+ Option [' T' ] [" tsv" ]
163
+ (NoArg (\ opts -> opts {optTsvOutput = True }))
164
+ " output in tsv format" ,
165
165
Option [' F' ] [" --field" ]
166
166
(ReqArg (\ d opts -> opts {optFieldInfo = optFieldInfo opts ++ [(readFieldOption d)]})
167
167
" String" )
@@ -218,11 +218,17 @@ printHelp = do
218
218
putStrLn " --substitute, -s expr Substitute input using the argument expression"
219
219
putStrLn " --map, -m expr Substitute each line of input using the argument expression"
220
220
putStrLn " --filter, -f expr Filter each line of input using the argument predicate"
221
+ putStrLn " "
222
+ putStrLn " Options to change input or output format:"
223
+ putStrLn " --tsv, -T Input and output in tsv format"
224
+ putStrLn " --field, -F field Specify a field type of input tsv"
225
+ putStrLn " --math, -M (asciimath|latex|mathematica)"
226
+ putStrLn " Output in AsciiMath, LaTeX, or Mathematica format (only for interpreter)"
221
227
exitWith ExitSuccess
222
228
223
229
printVersionNumber :: IO ()
224
230
printVersionNumber = do
225
- putStrLn $ showVersion version
231
+ putStrLn $ showVersion version
226
232
exitWith ExitSuccess
227
233
228
234
showBanner :: IO ()
@@ -244,9 +250,9 @@ repl noIOFlag isSExpr mathExprLang env prompt = do
244
250
where
245
251
settings :: MonadIO m => FilePath -> Settings m
246
252
settings home = setComplete completeEgison $ defaultSettings { historyFile = Just (home </> " .egison_history" ) }
247
-
253
+
248
254
loop :: Env -> IO ()
249
- loop env = (do
255
+ loop env = (do
250
256
home <- getHomeDirectory
251
257
input <- liftIO $ runInputT (settings home) $ getEgisonExpr isSExpr prompt
252
258
case (noIOFlag, input) of
0 commit comments