From b1c46dea2e4613d81dfef9bde7b828bbb31fdad6 Mon Sep 17 00:00:00 2001 From: Julian Date: Tue, 18 Mar 2025 08:50:24 +0100 Subject: [PATCH 1/4] chore: rename pglt_cli and binary --- Cargo.lock | 74 +++--- Cargo.toml | 2 +- crates/{pglt_cli => pgt_cli}/Cargo.toml | 4 +- crates/{pglt_cli => pgt_cli}/src/changed.rs | 0 .../{pglt_cli => pgt_cli}/src/cli_options.rs | 0 .../src/commands/check.rs | 0 .../src/commands/clean.rs | 0 .../src/commands/daemon.rs | 0 .../src/commands/init.rs | 0 .../{pglt_cli => pgt_cli}/src/commands/mod.rs | 2 +- .../src/commands/version.rs | 0 .../{pglt_cli => pgt_cli}/src/diagnostics.rs | 0 .../src/execute/diagnostics.rs | 0 .../{pglt_cli => pgt_cli}/src/execute/mod.rs | 0 .../src/execute/process_file.rs | 0 .../src/execute/process_file/check.rs | 0 .../execute/process_file/workspace_file.rs | 0 .../src/execute/std_in.rs | 0 .../src/execute/traverse.rs | 0 crates/{pglt_cli => pgt_cli}/src/lib.rs | 0 crates/{pglt_cli => pgt_cli}/src/logging.rs | 0 crates/{pglt_cli => pgt_cli}/src/main.rs | 2 +- crates/{pglt_cli => pgt_cli}/src/metrics.rs | 0 crates/{pglt_cli => pgt_cli}/src/panic.rs | 0 .../src/reporter/github.rs | 0 .../src/reporter/gitlab.rs | 0 .../src/reporter/junit.rs | 0 .../{pglt_cli => pgt_cli}/src/reporter/mod.rs | 0 .../src/reporter/terminal.rs | 0 .../{pglt_cli => pgt_cli}/src/service/mod.rs | 0 .../{pglt_cli => pgt_cli}/src/service/unix.rs | 0 .../src/service/windows.rs | 0 docs/cli_reference.md | 221 ++++++++---------- docs/codegen/Cargo.toml | 2 +- docs/codegen/src/cli_doc.rs | 2 +- 35 files changed, 145 insertions(+), 164 deletions(-) rename crates/{pglt_cli => pgt_cli}/Cargo.toml (97%) rename crates/{pglt_cli => pgt_cli}/src/changed.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/cli_options.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/commands/check.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/commands/clean.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/commands/daemon.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/commands/init.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/commands/mod.rs (99%) rename crates/{pglt_cli => pgt_cli}/src/commands/version.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/diagnostics.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/execute/diagnostics.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/execute/mod.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/execute/process_file.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/execute/process_file/check.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/execute/process_file/workspace_file.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/execute/std_in.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/execute/traverse.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/lib.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/logging.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/main.rs (99%) rename crates/{pglt_cli => pgt_cli}/src/metrics.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/panic.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/reporter/github.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/reporter/gitlab.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/reporter/junit.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/reporter/mod.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/reporter/terminal.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/service/mod.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/service/unix.rs (100%) rename crates/{pglt_cli => pgt_cli}/src/service/windows.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index c40f1910b..e7c7fb482 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1043,7 +1043,6 @@ dependencies = [ "bpaf", "pglt_analyse", "pglt_analyser", - "pglt_cli", "pglt_configuration", "pglt_console", "pglt_diagnostics", @@ -1051,6 +1050,7 @@ dependencies = [ "pglt_query_ext", "pglt_statement_splitter", "pglt_workspace", + "pgt_cli", "pulldown-cmark", "regex", "schemars", @@ -2338,42 +2338,6 @@ dependencies = [ "termcolor", ] -[[package]] -name = "pglt_cli" -version = "0.0.0" -dependencies = [ - "anyhow", - "biome_deserialize 0.6.0", - "biome_deserialize_macros 0.6.0", - "bpaf", - "crossbeam", - "dashmap 5.5.3", - "hdrhistogram", - "libc", - "mimalloc", - "path-absolutize", - "pglt_analyse", - "pglt_configuration", - "pglt_console", - "pglt_diagnostics", - "pglt_flags", - "pglt_fs", - "pglt_lsp", - "pglt_text_edit", - "pglt_workspace", - "quick-junit", - "rayon", - "rustc-hash 2.1.0", - "serde", - "serde_json", - "tikv-jemallocator", - "tokio", - "tracing", - "tracing-appender", - "tracing-subscriber", - "tracing-tree", -] - [[package]] name = "pglt_commands" version = "0.0.0" @@ -2736,6 +2700,42 @@ dependencies = [ "tree_sitter_sql", ] +[[package]] +name = "pgt_cli" +version = "0.0.0" +dependencies = [ + "anyhow", + "biome_deserialize 0.6.0", + "biome_deserialize_macros 0.6.0", + "bpaf", + "crossbeam", + "dashmap 5.5.3", + "hdrhistogram", + "libc", + "mimalloc", + "path-absolutize", + "pglt_analyse", + "pglt_configuration", + "pglt_console", + "pglt_diagnostics", + "pglt_flags", + "pglt_fs", + "pglt_lsp", + "pglt_text_edit", + "pglt_workspace", + "quick-junit", + "rayon", + "rustc-hash 2.1.0", + "serde", + "serde_json", + "tikv-jemallocator", + "tokio", + "tracing", + "tracing-appender", + "tracing-subscriber", + "tracing-tree", +] + [[package]] name = "pin-project" version = "1.1.7" diff --git a/Cargo.toml b/Cargo.toml index 3f7fbffac..fa75add23 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ unicode-width = "0.1.12" pglt_analyse = { path = "./crates/pglt_analyse", version = "0.0.0" } pglt_analyser = { path = "./crates/pglt_analyser", version = "0.0.0" } pglt_base_db = { path = "./crates/pglt_base_db", version = "0.0.0" } -pglt_cli = { path = "./crates/pglt_cli", version = "0.0.0" } +pgt_cli = { path = "./crates/pgt_cli", version = "0.0.0" } pglt_commands = { path = "./crates/pglt_commands", version = "0.0.0" } pglt_completions = { path = "./crates/pglt_completions", version = "0.0.0" } pglt_configuration = { path = "./crates/pglt_configuration", version = "0.0.0" } diff --git a/crates/pglt_cli/Cargo.toml b/crates/pgt_cli/Cargo.toml similarity index 97% rename from crates/pglt_cli/Cargo.toml rename to crates/pgt_cli/Cargo.toml index 204d20918..7c6e6779a 100644 --- a/crates/pglt_cli/Cargo.toml +++ b/crates/pgt_cli/Cargo.toml @@ -6,7 +6,7 @@ edition.workspace = true homepage.workspace = true keywords.workspace = true license.workspace = true -name = "pglt_cli" +name = "pgt_cli" repository.workspace = true version = "0.0.0" @@ -56,5 +56,5 @@ tikv-jemallocator = "0.6.0" doctest = false [[bin]] -name = "pglt" +name = "postgrestools" path = "src/main.rs" diff --git a/crates/pglt_cli/src/changed.rs b/crates/pgt_cli/src/changed.rs similarity index 100% rename from crates/pglt_cli/src/changed.rs rename to crates/pgt_cli/src/changed.rs diff --git a/crates/pglt_cli/src/cli_options.rs b/crates/pgt_cli/src/cli_options.rs similarity index 100% rename from crates/pglt_cli/src/cli_options.rs rename to crates/pgt_cli/src/cli_options.rs diff --git a/crates/pglt_cli/src/commands/check.rs b/crates/pgt_cli/src/commands/check.rs similarity index 100% rename from crates/pglt_cli/src/commands/check.rs rename to crates/pgt_cli/src/commands/check.rs diff --git a/crates/pglt_cli/src/commands/clean.rs b/crates/pgt_cli/src/commands/clean.rs similarity index 100% rename from crates/pglt_cli/src/commands/clean.rs rename to crates/pgt_cli/src/commands/clean.rs diff --git a/crates/pglt_cli/src/commands/daemon.rs b/crates/pgt_cli/src/commands/daemon.rs similarity index 100% rename from crates/pglt_cli/src/commands/daemon.rs rename to crates/pgt_cli/src/commands/daemon.rs diff --git a/crates/pglt_cli/src/commands/init.rs b/crates/pgt_cli/src/commands/init.rs similarity index 100% rename from crates/pglt_cli/src/commands/init.rs rename to crates/pgt_cli/src/commands/init.rs diff --git a/crates/pglt_cli/src/commands/mod.rs b/crates/pgt_cli/src/commands/mod.rs similarity index 99% rename from crates/pglt_cli/src/commands/mod.rs rename to crates/pgt_cli/src/commands/mod.rs index 16b7b9768..2799fc3bc 100644 --- a/crates/pglt_cli/src/commands/mod.rs +++ b/crates/pgt_cli/src/commands/mod.rs @@ -43,7 +43,7 @@ pub enum PgltCommand { /// /// The file doesn't need to exist on disk, what matters is the extension of the file. Based on the extension, we know how to check the code. /// - /// Example: `echo 'let a;' | pglt_cli check --stdin-file-path=test.sql` + /// Example: `echo 'let a;' | pgt_cli check --stdin-file-path=test.sql` #[bpaf(long("stdin-file-path"), argument("PATH"), hide_usage)] stdin_file_path: Option, diff --git a/crates/pglt_cli/src/commands/version.rs b/crates/pgt_cli/src/commands/version.rs similarity index 100% rename from crates/pglt_cli/src/commands/version.rs rename to crates/pgt_cli/src/commands/version.rs diff --git a/crates/pglt_cli/src/diagnostics.rs b/crates/pgt_cli/src/diagnostics.rs similarity index 100% rename from crates/pglt_cli/src/diagnostics.rs rename to crates/pgt_cli/src/diagnostics.rs diff --git a/crates/pglt_cli/src/execute/diagnostics.rs b/crates/pgt_cli/src/execute/diagnostics.rs similarity index 100% rename from crates/pglt_cli/src/execute/diagnostics.rs rename to crates/pgt_cli/src/execute/diagnostics.rs diff --git a/crates/pglt_cli/src/execute/mod.rs b/crates/pgt_cli/src/execute/mod.rs similarity index 100% rename from crates/pglt_cli/src/execute/mod.rs rename to crates/pgt_cli/src/execute/mod.rs diff --git a/crates/pglt_cli/src/execute/process_file.rs b/crates/pgt_cli/src/execute/process_file.rs similarity index 100% rename from crates/pglt_cli/src/execute/process_file.rs rename to crates/pgt_cli/src/execute/process_file.rs diff --git a/crates/pglt_cli/src/execute/process_file/check.rs b/crates/pgt_cli/src/execute/process_file/check.rs similarity index 100% rename from crates/pglt_cli/src/execute/process_file/check.rs rename to crates/pgt_cli/src/execute/process_file/check.rs diff --git a/crates/pglt_cli/src/execute/process_file/workspace_file.rs b/crates/pgt_cli/src/execute/process_file/workspace_file.rs similarity index 100% rename from crates/pglt_cli/src/execute/process_file/workspace_file.rs rename to crates/pgt_cli/src/execute/process_file/workspace_file.rs diff --git a/crates/pglt_cli/src/execute/std_in.rs b/crates/pgt_cli/src/execute/std_in.rs similarity index 100% rename from crates/pglt_cli/src/execute/std_in.rs rename to crates/pgt_cli/src/execute/std_in.rs diff --git a/crates/pglt_cli/src/execute/traverse.rs b/crates/pgt_cli/src/execute/traverse.rs similarity index 100% rename from crates/pglt_cli/src/execute/traverse.rs rename to crates/pgt_cli/src/execute/traverse.rs diff --git a/crates/pglt_cli/src/lib.rs b/crates/pgt_cli/src/lib.rs similarity index 100% rename from crates/pglt_cli/src/lib.rs rename to crates/pgt_cli/src/lib.rs diff --git a/crates/pglt_cli/src/logging.rs b/crates/pgt_cli/src/logging.rs similarity index 100% rename from crates/pglt_cli/src/logging.rs rename to crates/pgt_cli/src/logging.rs diff --git a/crates/pglt_cli/src/main.rs b/crates/pgt_cli/src/main.rs similarity index 99% rename from crates/pglt_cli/src/main.rs rename to crates/pgt_cli/src/main.rs index c79f5ab0b..4e86fd8d7 100644 --- a/crates/pglt_cli/src/main.rs +++ b/crates/pgt_cli/src/main.rs @@ -1,6 +1,6 @@ //! This is the main binary -use pglt_cli::{ +use pgt_cli::{ CliDiagnostic, CliSession, PgltCommand, open_transport, pglt_command, setup_panic_handler, to_color_mode, }; diff --git a/crates/pglt_cli/src/metrics.rs b/crates/pgt_cli/src/metrics.rs similarity index 100% rename from crates/pglt_cli/src/metrics.rs rename to crates/pgt_cli/src/metrics.rs diff --git a/crates/pglt_cli/src/panic.rs b/crates/pgt_cli/src/panic.rs similarity index 100% rename from crates/pglt_cli/src/panic.rs rename to crates/pgt_cli/src/panic.rs diff --git a/crates/pglt_cli/src/reporter/github.rs b/crates/pgt_cli/src/reporter/github.rs similarity index 100% rename from crates/pglt_cli/src/reporter/github.rs rename to crates/pgt_cli/src/reporter/github.rs diff --git a/crates/pglt_cli/src/reporter/gitlab.rs b/crates/pgt_cli/src/reporter/gitlab.rs similarity index 100% rename from crates/pglt_cli/src/reporter/gitlab.rs rename to crates/pgt_cli/src/reporter/gitlab.rs diff --git a/crates/pglt_cli/src/reporter/junit.rs b/crates/pgt_cli/src/reporter/junit.rs similarity index 100% rename from crates/pglt_cli/src/reporter/junit.rs rename to crates/pgt_cli/src/reporter/junit.rs diff --git a/crates/pglt_cli/src/reporter/mod.rs b/crates/pgt_cli/src/reporter/mod.rs similarity index 100% rename from crates/pglt_cli/src/reporter/mod.rs rename to crates/pgt_cli/src/reporter/mod.rs diff --git a/crates/pglt_cli/src/reporter/terminal.rs b/crates/pgt_cli/src/reporter/terminal.rs similarity index 100% rename from crates/pglt_cli/src/reporter/terminal.rs rename to crates/pgt_cli/src/reporter/terminal.rs diff --git a/crates/pglt_cli/src/service/mod.rs b/crates/pgt_cli/src/service/mod.rs similarity index 100% rename from crates/pglt_cli/src/service/mod.rs rename to crates/pgt_cli/src/service/mod.rs diff --git a/crates/pglt_cli/src/service/unix.rs b/crates/pgt_cli/src/service/unix.rs similarity index 100% rename from crates/pglt_cli/src/service/unix.rs rename to crates/pgt_cli/src/service/unix.rs diff --git a/crates/pglt_cli/src/service/windows.rs b/crates/pgt_cli/src/service/windows.rs similarity index 100% rename from crates/pglt_cli/src/service/windows.rs rename to crates/pgt_cli/src/service/windows.rs diff --git a/docs/cli_reference.md b/docs/cli_reference.md index 919b0d3e3..9a80a7c35 100644 --- a/docs/cli_reference.md +++ b/docs/cli_reference.md @@ -1,19 +1,17 @@ ## CLI Reference -[//]: # (BEGIN CLI_REF) - - +[//]: # "BEGIN CLI_REF" # Command summary - * [`pglt`↴](#pglt) - * [`pglt version`↴](#pglt-version) - * [`pglt check`↴](#pglt-check) - * [`pglt start`↴](#pglt-start) - * [`pglt stop`↴](#pglt-stop) - * [`pglt init`↴](#pglt-init) - * [`pglt lsp-proxy`↴](#pglt-lsp-proxy) - * [`pglt clean`↴](#pglt-clean) +- [`pglt`↴](#pglt) +- [`pglt version`↴](#pglt-version) +- [`pglt check`↴](#pglt-check) +- [`pglt start`↴](#pglt-start) +- [`pglt stop`↴](#pglt-stop) +- [`pglt init`↴](#pglt-init) +- [`pglt lsp-proxy`↴](#pglt-lsp-proxy) +- [`pglt clean`↴](#pglt-clean) ## pglt @@ -22,80 +20,76 @@ PgLT official CLI. Use it to check the health of your project or run it to check **Usage**: **`pglt`** _`COMMAND ...`_ **Available options:** -- **`-h`**, **`--help`** — + +- **`-h`**, **`--help`** — Prints help information -- **`-V`**, **`--version`** — +- **`-V`**, **`--version`** — Prints version information - - **Available commands:** -- **`version`** — + +- **`version`** — Shows the version information and quit. -- **`check`** — +- **`check`** — Runs everything to the requested files. -- **`start`** — +- **`start`** — Starts the daemon server process. -- **`stop`** — +- **`stop`** — Stops the daemon server process. -- **`init`** — +- **`init`** — Bootstraps a new project. Creates a configuration file with some defaults. -- **`lsp-proxy`** — +- **`lsp-proxy`** — Acts as a server for the Language Server Protocol over stdin/stdout. -- **`clean`** — +- **`clean`** — Cleans the logs emitted by the daemon. - ## pglt version Shows the version information and quit. -**Usage**: **`pglt`** **`version`** +**Usage**: **`pglt`** **`version`** **Global options applied to all commands** -- **` --colors`**=_``_ — + +- **` --colors`**=_``_ — Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible -- **` --use-server`** — +- **` --use-server`** — Connect to a running instance of the daemon server. -- **` --skip-db`** — +- **` --skip-db`** — Skip connecting to the database and only run checks that don't require a database connection. -- **` --verbose`** — +- **` --verbose`** — Print additional diagnostics, and some diagnostics show more information. Also, print out what files were processed and which ones were modified. -- **` --config-path`**=_`PATH`_ — +- **` --config-path`**=_`PATH`_ — Set the file path to the configuration file, or the directory path to find `pglt.jsonc`. If used, it disables the default configuration file resolution. -- **` --max-diagnostics`**=_`>`_ — +- **` --max-diagnostics`**=_`>`_ — Cap the amount of diagnostics displayed. When `none` is provided, the limit is lifted. - [default: 20] -- **` --skip-errors`** — +- **` --skip-errors`** — Skip over files containing syntax errors instead of emitting an error diagnostic. -- **` --no-errors-on-unmatched`** — +- **` --no-errors-on-unmatched`** — Silence errors that would be emitted in case no files were processed during the execution of the command. -- **` --error-on-warnings`** — +- **` --error-on-warnings`** — Tell PgLT to exit with an error code if some diagnostics emit warnings. -- **` --reporter`**=_``_ — +- **` --reporter`**=_``_ — Allows to change how diagnostics and summary are reported. -- **` --log-level`**=_``_ — +- **` --log-level`**=_``_ — The level of logging. In order, from the most verbose to the least verbose: debug, info, warn, error. The value `none` won't show any logging. - + [default: none] -- **` --log-kind`**=_``_ — + +- **` --log-kind`**=_``_ — How the log should look like. - [default: pretty] -- **` --diagnostic-level`**=_``_ — +- **` --diagnostic-level`**=_``_ — The level of diagnostics to show. In order, from the lowest to the most important: info, warn, error. Passing `--diagnostic-level=error` will cause PgLT to print only diagnostics that contain only errors. - [default: info] - - **Available options:** -- **`-h`**, **`--help`** — - Prints help information +- **`-h`**, **`--help`** — + Prints help information ## pglt check @@ -104,104 +98,100 @@ Runs everything to the requested files. **Usage**: **`pglt`** **`check`** \[**`--staged`**\] \[**`--changed`**\] \[**`--since`**=_`REF`_\] \[_`PATH`_\]... **The configuration that is contained inside the configuration file.** -- **` --vcs-enabled`**=_``_ — + +- **` --vcs-enabled`**=_``_ — Whether we should integrate itself with the VCS client -- **` --vcs-client-kind`**=_``_ — +- **` --vcs-client-kind`**=_``_ — The kind of client. -- **` --vcs-use-ignore-file`**=_``_ — +- **` --vcs-use-ignore-file`**=_``_ — Whether we should use the VCS ignore file. When [true], we will ignore the files specified in the ignore file. -- **` --vcs-root`**=_`PATH`_ — +- **` --vcs-root`**=_`PATH`_ — The folder where we should check for VCS files. By default, we will use the same folder where `pglt.jsonc` was found. If we can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, we won't use the VCS integration, and a diagnostic will be emitted -- **` --vcs-default-branch`**=_`BRANCH`_ — + +- **` --vcs-default-branch`**=_`BRANCH`_ — The main branch of the project -- **` --files-max-size`**=_`NUMBER`_ — +- **` --files-max-size`**=_`NUMBER`_ — The maximum allowed size for source code files in bytes. Files above this limit will be ignored for performance reasons. Defaults to 1 MiB -- **` --migrations-dir`**=_`ARG`_ — +- **` --migrations-dir`**=_`ARG`_ — The directory where the migration files are stored -- **` --after`**=_`ARG`_ — +- **` --after`**=_`ARG`_ — Ignore any migrations before this timestamp -- **` --host`**=_`ARG`_ — +- **` --host`**=_`ARG`_ — The host of the database. -- **` --port`**=_`ARG`_ — +- **` --port`**=_`ARG`_ — The port of the database. -- **` --username`**=_`ARG`_ — +- **` --username`**=_`ARG`_ — The username to connect to the database. -- **` --password`**=_`ARG`_ — +- **` --password`**=_`ARG`_ — The password to connect to the database. -- **` --database`**=_`ARG`_ — +- **` --database`**=_`ARG`_ — The name of the database. -- **` --conn_timeout_secs`**=_`ARG`_ — +- **` --conn_timeout_secs`**=_`ARG`_ — The connection timeout in seconds. - [default: Some(10)] - - **Global options applied to all commands** -- **` --colors`**=_``_ — + +- **` --colors`**=_``_ — Set the formatting mode for markup: "off" prints everything as plain text, "force" forces the formatting of markup using ANSI even if the console output is determined to be incompatible -- **` --use-server`** — +- **` --use-server`** — Connect to a running instance of the daemon server. -- **` --skip-db`** — +- **` --skip-db`** — Skip connecting to the database and only run checks that don't require a database connection. -- **` --verbose`** — +- **` --verbose`** — Print additional diagnostics, and some diagnostics show more information. Also, print out what files were processed and which ones were modified. -- **` --config-path`**=_`PATH`_ — +- **` --config-path`**=_`PATH`_ — Set the file path to the configuration file, or the directory path to find `pglt.jsonc`. If used, it disables the default configuration file resolution. -- **` --max-diagnostics`**=_`>`_ — +- **` --max-diagnostics`**=_`>`_ — Cap the amount of diagnostics displayed. When `none` is provided, the limit is lifted. - [default: 20] -- **` --skip-errors`** — +- **` --skip-errors`** — Skip over files containing syntax errors instead of emitting an error diagnostic. -- **` --no-errors-on-unmatched`** — +- **` --no-errors-on-unmatched`** — Silence errors that would be emitted in case no files were processed during the execution of the command. -- **` --error-on-warnings`** — +- **` --error-on-warnings`** — Tell PgLT to exit with an error code if some diagnostics emit warnings. -- **` --reporter`**=_``_ — +- **` --reporter`**=_``_ — Allows to change how diagnostics and summary are reported. -- **` --log-level`**=_``_ — +- **` --log-level`**=_``_ — The level of logging. In order, from the most verbose to the least verbose: debug, info, warn, error. The value `none` won't show any logging. - + [default: none] -- **` --log-kind`**=_``_ — + +- **` --log-kind`**=_``_ — How the log should look like. - [default: pretty] -- **` --diagnostic-level`**=_``_ — +- **` --diagnostic-level`**=_``_ — The level of diagnostics to show. In order, from the lowest to the most important: info, warn, error. Passing `--diagnostic-level=error` will cause PgLT to print only diagnostics that contain only errors. - [default: info] - - **Available positional items:** -- _`PATH`_ — - Single file, single path or list of paths - +- _`PATH`_ — + Single file, single path or list of paths **Available options:** -- **` --stdin-file-path`**=_`PATH`_ — + +- **` --stdin-file-path`**=_`PATH`_ — Use this option when you want to format code piped from `stdin`, and print the output to `stdout`. The file doesn't need to exist on disk, what matters is the extension of the file. Based on the extension, we know how to check the code. - Example: `echo 'let a;' | pglt_cli check --stdin-file-path=test.sql` -- **` --staged`** — + Example: `echo 'let a;' | pgt_cli check --stdin-file-path=test.sql` + +- **` --staged`** — When set to true, only the files that have been staged (the ones prepared to be committed) will be linted. This option should be used when working locally. -- **` --changed`** — +- **` --changed`** — When set to true, only the files that have been changed compared to your `defaultBranch` configuration will be linted. This option should be used in CI environments. -- **` --since`**=_`REF`_ — +- **` --since`**=_`REF`_ — Use this to specify the base branch to compare against when you're using the --changed flag and the `defaultBranch` is not set in your `pglt.jsonc` -- **`-h`**, **`--help`** — +- **`-h`**, **`--help`** — Prints help information - ## pglt start Starts the daemon server process. @@ -209,45 +199,41 @@ Starts the daemon server process. **Usage**: **`pglt`** **`start`** \[**`--config-path`**=_`PATH`_\] **Available options:** -- **` --log-prefix-name`**=_`STRING`_ — + +- **` --log-prefix-name`**=_`STRING`_ — Allows to change the prefix applied to the file name of the logs. - Uses environment variable **`PGLT_LOG_PREFIX_NAME`** - [default: server.log] -- **` --log-path`**=_`PATH`_ — +- **` --log-path`**=_`PATH`_ — Allows to change the folder where logs are stored. - Uses environment variable **`PGLT_LOG_PATH`** -- **` --config-path`**=_`PATH`_ — +- **` --config-path`**=_`PATH`_ — Allows to set a custom file path to the configuration file, or a custom directory path to find `pglt.jsonc` - Uses environment variable **`PGLT_LOG_PREFIX_NAME`** -- **`-h`**, **`--help`** — +- **`-h`**, **`--help`** — Prints help information - ## pglt stop Stops the daemon server process. -**Usage**: **`pglt`** **`stop`** +**Usage**: **`pglt`** **`stop`** **Available options:** -- **`-h`**, **`--help`** — - Prints help information +- **`-h`**, **`--help`** — + Prints help information ## pglt init Bootstraps a new project. Creates a configuration file with some defaults. -**Usage**: **`pglt`** **`init`** +**Usage**: **`pglt`** **`init`** **Available options:** -- **`-h`**, **`--help`** — - Prints help information +- **`-h`**, **`--help`** — + Prints help information ## pglt lsp-proxy @@ -256,34 +242,29 @@ Acts as a server for the Language Server Protocol over stdin/stdout. **Usage**: **`pglt`** **`lsp-proxy`** \[**`--config-path`**=_`PATH`_\] **Available options:** -- **` --log-prefix-name`**=_`STRING`_ — + +- **` --log-prefix-name`**=_`STRING`_ — Allows to change the prefix applied to the file name of the logs. - Uses environment variable **`PGLT_LOG_PREFIX_NAME`** - [default: server.log] -- **` --log-path`**=_`PATH`_ — +- **` --log-path`**=_`PATH`_ — Allows to change the folder where logs are stored. - Uses environment variable **`PGLT_LOG_PATH`** -- **` --config-path`**=_`PATH`_ — +- **` --config-path`**=_`PATH`_ — Allows to set a custom file path to the configuration file, or a custom directory path to find `pglt.jsonc` - Uses environment variable **`PGLT_CONFIG_PATH`** -- **`-h`**, **`--help`** — +- **`-h`**, **`--help`** — Prints help information - ## pglt clean Cleans the logs emitted by the daemon. -**Usage**: **`pglt`** **`clean`** +**Usage**: **`pglt`** **`clean`** **Available options:** -- **`-h`**, **`--help`** — - Prints help information - +- **`-h`**, **`--help`** — + Prints help information -[//]: # (END CLI_REF) +[//]: # "END CLI_REF" diff --git a/docs/codegen/Cargo.toml b/docs/codegen/Cargo.toml index ba1bc52f3..948574c57 100644 --- a/docs/codegen/Cargo.toml +++ b/docs/codegen/Cargo.toml @@ -22,7 +22,7 @@ pulldown-cmark = "0.12.2" pglt_configuration = { workspace = true, features = ["schema"] } pglt_flags = { workspace = true } -pglt_cli = { workspace = true } +pgt_cli = { workspace = true } pglt_analyse = { workspace = true } pglt_analyser = { workspace = true } pglt_diagnostics = { workspace = true } diff --git a/docs/codegen/src/cli_doc.rs b/docs/codegen/src/cli_doc.rs index ad299605d..cbde10282 100644 --- a/docs/codegen/src/cli_doc.rs +++ b/docs/codegen/src/cli_doc.rs @@ -1,4 +1,4 @@ -use pglt_cli::pglt_command; +use pgt_cli::pglt_command; use std::{fs, path::Path}; use crate::utils; From 8222ce3183199fcdd69153e741b52dc76bf4386a Mon Sep 17 00:00:00 2001 From: Julian Date: Tue, 18 Mar 2025 08:53:50 +0100 Subject: [PATCH 2/4] docs --- docs/cli_reference.md | 62 +++++++++++++++++++++---------------------- xtask/src/install.rs | 2 +- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/docs/cli_reference.md b/docs/cli_reference.md index 9a80a7c35..8779372af 100644 --- a/docs/cli_reference.md +++ b/docs/cli_reference.md @@ -4,20 +4,20 @@ # Command summary -- [`pglt`↴](#pglt) -- [`pglt version`↴](#pglt-version) -- [`pglt check`↴](#pglt-check) -- [`pglt start`↴](#pglt-start) -- [`pglt stop`↴](#pglt-stop) -- [`pglt init`↴](#pglt-init) -- [`pglt lsp-proxy`↴](#pglt-lsp-proxy) -- [`pglt clean`↴](#pglt-clean) +- [`postgrestools`↴](#postgrestools) +- [`postgrestools version`↴](#postgrestools-version) +- [`postgrestools check`↴](#postgrestools-check) +- [`postgrestools start`↴](#postgrestools-start) +- [`postgrestools stop`↴](#postgrestools-stop) +- [`postgrestools init`↴](#postgrestools-init) +- [`postgrestools lsp-proxy`↴](#postgrestools-lsp-proxy) +- [`postgrestools clean`↴](#postgrestools-clean) -## pglt +## postgrestools -PgLT official CLI. Use it to check the health of your project or run it to check single files. +PostgresTools official CLI. Use it to check the health of your project or run it to check single files. -**Usage**: **`pglt`** _`COMMAND ...`_ +**Usage**: **`postgrestools`** _`COMMAND ...`_ **Available options:** @@ -43,11 +43,11 @@ PgLT official CLI. Use it to check the health of your project or run it to check - **`clean`** — Cleans the logs emitted by the daemon. -## pglt version +## postgrestools version Shows the version information and quit. -**Usage**: **`pglt`** **`version`** +**Usage**: **`postgrestools`** **`version`** **Global options applied to all commands** @@ -60,7 +60,7 @@ Shows the version information and quit. - **` --verbose`** — Print additional diagnostics, and some diagnostics show more information. Also, print out what files were processed and which ones were modified. - **` --config-path`**=_`PATH`_ — - Set the file path to the configuration file, or the directory path to find `pglt.jsonc`. If used, it disables the default configuration file resolution. + Set the file path to the configuration file, or the directory path to find `postgrestools.jsonc`. If used, it disables the default configuration file resolution. - **` --max-diagnostics`**=_`>`_ — Cap the amount of diagnostics displayed. When `none` is provided, the limit is lifted. [default: 20] @@ -91,11 +91,11 @@ Shows the version information and quit. - **`-h`**, **`--help`** — Prints help information -## pglt check +## postgrestools check Runs everything to the requested files. -**Usage**: **`pglt`** **`check`** \[**`--staged`**\] \[**`--changed`**\] \[**`--since`**=_`REF`_\] \[_`PATH`_\]... +**Usage**: **`postgrestools`** **`check`** \[**`--staged`**\] \[**`--changed`**\] \[**`--since`**=_`REF`_\] \[_`PATH`_\]... **The configuration that is contained inside the configuration file.** @@ -106,7 +106,7 @@ Runs everything to the requested files. - **` --vcs-use-ignore-file`**=_``_ — Whether we should use the VCS ignore file. When [true], we will ignore the files specified in the ignore file. - **` --vcs-root`**=_`PATH`_ — - The folder where we should check for VCS files. By default, we will use the same folder where `pglt.jsonc` was found. + The folder where we should check for VCS files. By default, we will use the same folder where `postgrestools.jsonc` was found. If we can't find the configuration, it will attempt to use the current working directory. If no current working directory can't be found, we won't use the VCS integration, and a diagnostic will be emitted @@ -143,7 +143,7 @@ Runs everything to the requested files. - **` --verbose`** — Print additional diagnostics, and some diagnostics show more information. Also, print out what files were processed and which ones were modified. - **` --config-path`**=_`PATH`_ — - Set the file path to the configuration file, or the directory path to find `pglt.jsonc`. If used, it disables the default configuration file resolution. + Set the file path to the configuration file, or the directory path to find `postgrestools.jsonc`. If used, it disables the default configuration file resolution. - **` --max-diagnostics`**=_`>`_ — Cap the amount of diagnostics displayed. When `none` is provided, the limit is lifted. [default: 20] @@ -188,15 +188,15 @@ Runs everything to the requested files. - **` --changed`** — When set to true, only the files that have been changed compared to your `defaultBranch` configuration will be linted. This option should be used in CI environments. - **` --since`**=_`REF`_ — - Use this to specify the base branch to compare against when you're using the --changed flag and the `defaultBranch` is not set in your `pglt.jsonc` + Use this to specify the base branch to compare against when you're using the --changed flag and the `defaultBranch` is not set in your `postgrestools.jsonc` - **`-h`**, **`--help`** — Prints help information -## pglt start +## postgrestools start Starts the daemon server process. -**Usage**: **`pglt`** **`start`** \[**`--config-path`**=_`PATH`_\] +**Usage**: **`postgrestools`** **`start`** \[**`--config-path`**=_`PATH`_\] **Available options:** @@ -208,38 +208,38 @@ Starts the daemon server process. Allows to change the folder where logs are stored. Uses environment variable **`PGLT_LOG_PATH`** - **` --config-path`**=_`PATH`_ — - Allows to set a custom file path to the configuration file, or a custom directory path to find `pglt.jsonc` + Allows to set a custom file path to the configuration file, or a custom directory path to find `postgrestools.jsonc` Uses environment variable **`PGLT_LOG_PREFIX_NAME`** - **`-h`**, **`--help`** — Prints help information -## pglt stop +## postgrestools stop Stops the daemon server process. -**Usage**: **`pglt`** **`stop`** +**Usage**: **`postgrestools`** **`stop`** **Available options:** - **`-h`**, **`--help`** — Prints help information -## pglt init +## postgrestools init Bootstraps a new project. Creates a configuration file with some defaults. -**Usage**: **`pglt`** **`init`** +**Usage**: **`postgrestools`** **`init`** **Available options:** - **`-h`**, **`--help`** — Prints help information -## pglt lsp-proxy +## postgrestools lsp-proxy Acts as a server for the Language Server Protocol over stdin/stdout. -**Usage**: **`pglt`** **`lsp-proxy`** \[**`--config-path`**=_`PATH`_\] +**Usage**: **`postgrestools`** **`lsp-proxy`** \[**`--config-path`**=_`PATH`_\] **Available options:** @@ -251,16 +251,16 @@ Acts as a server for the Language Server Protocol over stdin/stdout. Allows to change the folder where logs are stored. Uses environment variable **`PGLT_LOG_PATH`** - **` --config-path`**=_`PATH`_ — - Allows to set a custom file path to the configuration file, or a custom directory path to find `pglt.jsonc` + Allows to set a custom file path to the configuration file, or a custom directory path to find `postgrestools.jsonc` Uses environment variable **`PGLT_CONFIG_PATH`** - **`-h`**, **`--help`** — Prints help information -## pglt clean +## postgrestools clean Cleans the logs emitted by the daemon. -**Usage**: **`pglt`** **`clean`** +**Usage**: **`postgrestools`** **`clean`** **Available options:** diff --git a/xtask/src/install.rs b/xtask/src/install.rs index 227170089..faaf5c56f 100644 --- a/xtask/src/install.rs +++ b/xtask/src/install.rs @@ -137,7 +137,7 @@ fn install_client(sh: &Shell, client_opt: ClientOpt) -> anyhow::Result<()> { } fn install_server(sh: &Shell) -> anyhow::Result<()> { - let cmd = cmd!(sh, "cargo install --path crates/pglt_cli --locked --force"); + let cmd = cmd!(sh, "cargo install --path crates/pgt_cli --locked --force"); cmd.run()?; Ok(()) } From 1685c8060e578e16111d9d8ab259f95d0a47309c Mon Sep 17 00:00:00 2001 From: Julian Date: Tue, 18 Mar 2025 08:55:54 +0100 Subject: [PATCH 3/4] format --- Cargo.toml | 2 +- crates/pgt_cli/src/main.rs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index fa75add23..42fffe71d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,6 @@ unicode-width = "0.1.12" pglt_analyse = { path = "./crates/pglt_analyse", version = "0.0.0" } pglt_analyser = { path = "./crates/pglt_analyser", version = "0.0.0" } pglt_base_db = { path = "./crates/pglt_base_db", version = "0.0.0" } -pgt_cli = { path = "./crates/pgt_cli", version = "0.0.0" } pglt_commands = { path = "./crates/pglt_commands", version = "0.0.0" } pglt_completions = { path = "./crates/pglt_completions", version = "0.0.0" } pglt_configuration = { path = "./crates/pglt_configuration", version = "0.0.0" } @@ -81,6 +80,7 @@ pglt_treesitter_queries = { path = "./crates/pglt_treesitter_queries", versi pglt_type_resolver = { path = "./crates/pglt_type_resolver", version = "0.0.0" } pglt_typecheck = { path = "./crates/pglt_typecheck", version = "0.0.0" } pglt_workspace = { path = "./crates/pglt_workspace", version = "0.0.0" } +pgt_cli = { path = "./crates/pgt_cli", version = "0.0.0" } pglt_test_macros = { path = "./crates/pglt_test_macros" } pglt_test_utils = { path = "./crates/pglt_test_utils" } diff --git a/crates/pgt_cli/src/main.rs b/crates/pgt_cli/src/main.rs index 4e86fd8d7..dcdc1096e 100644 --- a/crates/pgt_cli/src/main.rs +++ b/crates/pgt_cli/src/main.rs @@ -1,12 +1,12 @@ //! This is the main binary +use pglt_console::{ConsoleExt, EnvConsole, markup}; +use pglt_diagnostics::{Diagnostic, PrintDiagnostic, set_bottom_frame}; +use pglt_workspace::workspace; use pgt_cli::{ CliDiagnostic, CliSession, PgltCommand, open_transport, pglt_command, setup_panic_handler, to_color_mode, }; -use pglt_console::{ConsoleExt, EnvConsole, markup}; -use pglt_diagnostics::{Diagnostic, PrintDiagnostic, set_bottom_frame}; -use pglt_workspace::workspace; use std::process::{ExitCode, Termination}; use tokio::runtime::Runtime; From a24644a93ed975fcbed43c9a76bf0230b11672d5 Mon Sep 17 00:00:00 2001 From: Julian Date: Tue, 18 Mar 2025 09:21:45 +0100 Subject: [PATCH 4/4] ok --- .../backend-jsonrpc/src/workspace.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/packages/@postgrestools/backend-jsonrpc/src/workspace.ts b/packages/@postgrestools/backend-jsonrpc/src/workspace.ts index e71d94575..d7892f46a 100644 --- a/packages/@postgrestools/backend-jsonrpc/src/workspace.ts +++ b/packages/@postgrestools/backend-jsonrpc/src/workspace.ts @@ -423,28 +423,28 @@ export interface Workspace { export function createWorkspace(transport: Transport): Workspace { return { isPathIgnored(params) { - return transport.request("pgt/is_path_ignored", params); + return transport.request("pglt/is_path_ignored", params); }, getFileContent(params) { - return transport.request("pgt/get_file_content", params); + return transport.request("pglt/get_file_content", params); }, pullDiagnostics(params) { - return transport.request("pgt/pull_diagnostics", params); + return transport.request("pglt/pull_diagnostics", params); }, getCompletions(params) { - return transport.request("pgt/get_completions", params); + return transport.request("pglt/get_completions", params); }, updateSettings(params) { - return transport.request("pgt/update_settings", params); + return transport.request("pglt/update_settings", params); }, openFile(params) { - return transport.request("pgt/open_file", params); + return transport.request("pglt/open_file", params); }, changeFile(params) { - return transport.request("pgt/change_file", params); + return transport.request("pglt/change_file", params); }, closeFile(params) { - return transport.request("pgt/close_file", params); + return transport.request("pglt/close_file", params); }, destroy() { transport.destroy();