Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
18608f7b
Commit
18608f7b
authored
Jun 24, 2013
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add --version option to capnpc (issue 12)
parent
0b59de61
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
0 deletions
+9
-0
Main.hs
compiler/src/Main.hs
+9
-0
No files found.
compiler/src/Main.hs
View file @
18608f7b
...
...
@@ -54,6 +54,8 @@ import WireFormat(encodeSchema)
import
CxxGenerator
(
generateCxx
)
version
=
"Cap'n Proto Compiler 0.1.0-pre (from git)"
type
GeneratorFn
=
[
FileDesc
]
->
[
Word8
]
->
Map
.
Map
Word64
[
Word8
]
->
IO
[(
FilePath
,
LZ
.
ByteString
)]
generatorFns
::
Map
.
Map
String
GeneratorFn
...
...
@@ -64,6 +66,7 @@ data Opt = SearchPathOpt FilePath
|
SrcPrefixOpt
String
|
VerboseOpt
|
HelpOpt
|
VersionOpt
|
GenIdOpt
main
::
IO
()
...
...
@@ -84,6 +87,7 @@ main = do
,
Option
"v"
[
"verbose"
]
(
NoArg
VerboseOpt
)
"Write information about parsed files."
,
Option
"i"
[
"generate-id"
]
(
NoArg
GenIdOpt
)
"Generate a new unique ID."
,
Option
"h"
[
"help"
]
(
NoArg
HelpOpt
)
"Print usage info and exit."
,
Option
""
[
"version"
]
(
NoArg
VersionOpt
)
"Print version number and exit."
]
let
usage
=
usageInfo
"capnpc [OPTION]... [FILE]...
\n\
...
...
@@ -106,6 +110,11 @@ main = do
putStr
usage
exitSuccess
)
let
isVersion
=
not
$
null
[
opt
|
opt
@
VersionOpt
<-
options
]
when
isVersion
(
do
putStr
(
version
++
"
\n
"
)
exitSuccess
)
let
isGenId
=
not
$
null
[
opt
|
opt
@
GenIdOpt
<-
options
]
when
isGenId
(
do
i
<-
generateId
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment