diff --git a/CHANGELOG.md b/CHANGELOG.md index a84bf11ba2..3aaf08ecb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ This project adheres to [Semantic Versioning](http://semver.org/). ### Changed - #3248, Modified some CLI options - @taimoorzaeem + Replace ``-e`` and ``--example`` with ``--example-file`` + + Rename option ``--dump-schema`` to ``--dump-schema-cache`` ### Deprecated diff --git a/docs/references/cli.rst b/docs/references/cli.rst index da04fb7c7c..5b4b5683cc 100644 --- a/docs/references/cli.rst +++ b/docs/references/cli.rst @@ -48,6 +48,6 @@ Dump Schema .. code:: bash - $ postgrest [--dump-schema] + $ postgrest [--dump-schema-cache] Dumps the schema cache in JSON format. diff --git a/nix/tools/tests.nix b/nix/tools/tests.nix index f842b7948c..65c5efdbcf 100644 --- a/nix/tools/tests.nix +++ b/nix/tools/tests.nix @@ -128,7 +128,7 @@ let '' ${withTools.withPg} -f test/spec/fixtures/load.sql \ ${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \ - postgrest --dump-schema + postgrest --dump-schema-cache ''; coverage = diff --git a/src/PostgREST/CLI.hs b/src/PostgREST/CLI.hs index 5259d2636e..95c35a7e07 100644 --- a/src/PostgREST/CLI.hs +++ b/src/PostgREST/CLI.hs @@ -44,7 +44,7 @@ main CLI{cliCommand, cliPath} = do CmdDumpConfig -> do when configDbConfig $ AppState.reReadConfig True appState putStr . Config.toText =<< AppState.getConfig appState - CmdDumpSchema -> putStrLn =<< dumpSchema appState + CmdDumpSchemaCache -> putStrLn =<< dumpSchema appState CmdRun -> App.run appState) -- | Dump SchemaCache schema to JSON @@ -71,7 +71,7 @@ data CLI = CLI data Command = CmdRun | CmdDumpConfig - | CmdDumpSchema + | CmdDumpSchemaCache data Example = ExampleFile | ExampleDb | ExampleEnv @@ -116,7 +116,7 @@ readCLIShowHelp = cliParser :: O.Parser CLI cliParser = CLI - <$> (dumpConfigFlag <|> dumpSchemaFlag) + <$> (dumpConfigFlag <|> dumpSchemaCacheFlag) <*> O.optional configFileOption configFileOption = @@ -129,9 +129,9 @@ readCLIShowHelp = O.long "dump-config" <> O.help "Dump loaded configuration and exit" - dumpSchemaFlag = - O.flag CmdRun CmdDumpSchema $ - O.long "dump-schema" + dumpSchemaCacheFlag = + O.flag CmdRun CmdDumpSchemaCache $ + O.long "dump-schema-cache" <> O.help "Dump loaded schema as JSON and exit (for debugging, output structure is unstable)" exampleConfig :: Example -> [Char] diff --git a/test/io/fixtures.yaml b/test/io/fixtures.yaml index 75aff7f45f..0fd83e46ac 100644 --- a/test/io/fixtures.yaml +++ b/test/io/fixtures.yaml @@ -17,7 +17,7 @@ cli: - name: dump config args: ['--dump-config'] - name: dump schema - args: ['--dump-schema'] + args: ['--dump-schema-cache'] use_defaultenv: true - name: no config # failures: config files diff --git a/test/io/test_cli.py b/test/io/test_cli.py index a85a0111c2..f00828201d 100644 --- a/test/io/test_cli.py +++ b/test/io/test_cli.py @@ -261,7 +261,9 @@ def test_invalid_openapi_mode(invalidopenapimodes, defaultenv): def test_schema_cache_snapshot(baseenv, key, snapshot_yaml): "Dump of schema cache should match snapshot." - schema_cache = yaml.load(cli(["--dump-schema"], env=baseenv), Loader=yaml.Loader) + schema_cache = yaml.load( + cli(["--dump-schema-cache"], env=baseenv), Loader=yaml.Loader + ) formatted = yaml.dump( schema_cache[key], encoding="utf8",