From be2bce7ea79a7fb84078c30328690222edcf45d2 Mon Sep 17 00:00:00 2001 From: Laurence Isla Date: Fri, 7 Jul 2023 14:38:07 -0500 Subject: [PATCH 1/3] Add the -v/--version option to show the version information --- src/PostgREST/CLI.hs | 8 +++++++- test/io/fixtures.yaml | 4 ++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/PostgREST/CLI.hs b/src/PostgREST/CLI.hs index 5508d985dd..1873a188e8 100644 --- a/src/PostgREST/CLI.hs +++ b/src/PostgREST/CLI.hs @@ -80,7 +80,7 @@ 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 $ @@ -88,6 +88,12 @@ readCLIShowHelp = <> 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" + exampleParser = O.infoOption exampleConfigFile $ O.long "example" diff --git a/test/io/fixtures.yaml b/test/io/fixtures.yaml index 8aa8993fd9..c27e0007b0 100644 --- a/test/io/fixtures.yaml +++ b/test/io/fixtures.yaml @@ -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 From 978691a84873c6916ea4f2fc9e84a987465805b0 Mon Sep 17 00:00:00 2001 From: Laurence Isla Date: Fri, 7 Jul 2023 16:46:09 -0500 Subject: [PATCH 2/3] fix option name --- src/PostgREST/CLI.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PostgREST/CLI.hs b/src/PostgREST/CLI.hs index 1873a188e8..8f4626ad4a 100644 --- a/src/PostgREST/CLI.hs +++ b/src/PostgREST/CLI.hs @@ -80,7 +80,7 @@ readCLIShowHelp = where prefs = O.prefs $ O.showHelpOnError <> O.showHelpOnEmpty opts = O.info parser $ O.fullDesc <> progDesc - parser = O.helper <*> versionParser <*> exampleParser <*> cliParser + parser = O.helper <*> versionFlag <*> exampleParser <*> cliParser progDesc = O.progDesc $ @@ -88,7 +88,7 @@ readCLIShowHelp = <> BS.unpack prettyVersion <> " / create a REST API to an existing Postgres database" - versionParser = + versionFlag = O.infoOption ("PostgREST " <> BS.unpack prettyVersion) $ O.long "version" <> O.short 'v' From 2daca0e878397529b1e01ae51f0d7c80fb434ecf Mon Sep 17 00:00:00 2001 From: Laurence Isla Date: Fri, 7 Jul 2023 17:23:24 -0500 Subject: [PATCH 3/3] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0a6cdced4..06e50c2add 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). + Data representations preserve the ability to write to the original column and require no extra storage or complex triggers (compared to using `GENERATED ALWAYS` columns) + Note: data representations require Postgres 10 (Postgres 11 if using `IN` predicates); data representations are not implemented for RPC - #2647, Allow to verify the PostgREST version in SQL: `select distinct application_name from pg_stat_activity`. - @laurenceisla + - #2856, Add the `--version` CLI option that prints the version information - @laurenceisla ### Fixed