Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add the -v/--version option to show the version information #2856

Merged
merged 3 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/PostgREST/CLI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,20 @@ readCLIShowHelp =
where
prefs = O.prefs $ O.showHelpOnError <> O.showHelpOnEmpty
opts = O.info parser $ O.fullDesc <> progDesc
parser = O.helper <*> exampleParser <*> cliParser
parser = O.helper <*> versionParser <*> exampleParser <*> cliParser

progDesc =
O.progDesc $
"PostgREST "
<> BS.unpack prettyVersion
<> " / create a REST API to an existing Postgres database"

versionParser =
O.infoOption ("PostgREST " <> BS.unpack prettyVersion) $
O.long "version"
<> O.short 'v'
<> O.help "Show the version information"

steve-chavez marked this conversation as resolved.
Show resolved Hide resolved
exampleParser =
O.infoOption exampleConfigFile $
O.long "example"
Expand Down
4 changes: 4 additions & 0 deletions test/io/fixtures.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ cli:
args: ['--help']
- name: help short
args: ['-h']
- name: version long
args: ['--version']
- name: version short
args: ['-v']
- name: example long
args: ['--example']
- name: example short
Expand Down