### Install Taplo CLI using Homebrew Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/homebrew.md Use this command to install the Taplo CLI if you have Homebrew set up on your system. ```sh brew install taplo ``` -------------------------------- ### Install Taplo CLI on Linux Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/binary.md This command downloads the latest x86_64 Linux release, decompresses it, and installs it to /usr/local/bin/taplo with execute permissions. ```bash curl -fsSL https://github.com/tamasfe/taplo/releases/latest/download/taplo-linux-x86_64.gz \ | gzip -d - | install -m 755 /dev/stdin /usr/local/bin/taplo ``` -------------------------------- ### Install Taplo CLI with npm Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/npm.md Installs the Taplo CLI globally using npm. Requires Node.js (version 16 or higher). ```sh npm install -g @taplo/cli ``` -------------------------------- ### Install Taplo CLI with pnpm Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/npm.md Installs the Taplo CLI globally using pnpm. Requires Node.js (version 16 or higher). ```sh pnpm install -g @taplo/cli ``` -------------------------------- ### Install Taplo CLI with Yarn Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/npm.md Installs the Taplo CLI globally using Yarn. Requires Node.js (version 16 or higher). ```sh yarn global add @taplo/cli ``` -------------------------------- ### Install taplo-cli using Cargo Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/cargo.md Use this command to install the Taplo CLI from crates.io. It's recommended to use the `--locked` flag to ensure dependency compatibility. ```sh cargo install taplo-cli --locked ``` -------------------------------- ### Run Taplo Language Server via TCP Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/language-server.md Starts the Taplo language server listening on a specified TCP address and port. This allows for network-based communication with the server. Note that multiple clients are not supported. ```bash taplo lsp tcp --address 0.0.0.0:9181 ``` -------------------------------- ### Taplo Schema Extension Example Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/developing-schemas.md Demonstrates the usage of the `x-taplo` extension field for adding metadata such as documentation, enum value details, default value documentation, links, and initial keys for object schemas. ```jsonc { "type": "string", "title": "My Type", "enum": ["one", "two", "three"], "default": "one", // ... // All the keys in the extension are optional. "x-taplo": { // Hide the schema from completion and similar hints. "hidden": true, "docs": { // Main documentation for the schema, it is expected to be markdown. // If this is omitted, the description will be used. "main": "This is [My Schema](https://example.com/mySchema)", // Documentation of the enum values, these are used when selecting // the values completion or hovering over them. // // These are selected by matching the indices of the enum values. // If a value doesn't have documentation in the middle of the array, // null can be used instead of a string. "enumValues": [ "Documentation of 'one'.", null, "Documentation of 'three'." ], // The documentation of the default value, same as the enum docs. "defaultValue": "Documentation of 'one'." }, "links": { // An URL the key will point to if the schema is part of a table. "key": "https://example.com/mySchema", // Different enum values can also have URLs they will point to. // The rules are the same as enum docs. "enumValues": ["https://example.com/one", "https://example.com/two"] }, // If the schema is an object, we can hint what // fields are typically important. // // These will be created automatically along with // the required properties during autocompletion. "initKeys": ["importantKey"] } } ``` -------------------------------- ### Run Taplo CLI without installing using pnpm dlx Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/npm.md Executes the Taplo CLI once using pnpm dlx without a global installation. An alternative to npx for running packages directly. ```sh pnpm dlx @taplo/cli --help ``` -------------------------------- ### Run Taplo CLI without installing using npx Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/npm.md Executes the Taplo CLI once using npx without a global installation. Useful for quick checks or one-off commands. ```sh npx @taplo/cli --help ``` -------------------------------- ### Run Taplo Docker Image Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/installation/docker.md Execute the Taplo Docker image to access its command-line interface and view help information. This is useful for verifying the installation or understanding available commands. ```sh docker run tamasfe/taplo --help ``` -------------------------------- ### Override Formatter Options Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/formatting.md Specify formatter options directly on the command line using the `--option` flag to override settings from the configuration file. This example disables table indentation. ```sh taplo fmt --option indent_tables=false foo.toml ``` -------------------------------- ### Set Log Level to Error Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/configuration.md Example of setting the RUST_LOG environment variable to 'error' to only display error messages when running the 'taplo lint' command. ```shell RUST_LOG=error taplo lint foo.toml ``` -------------------------------- ### Configure Schema Path and Enable Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/file.md Specify the path to a schema file (local or URL) and whether schema validation is enabled. ```toml [schema] path = "./path/to/schema.json" enabled = true ``` -------------------------------- ### Run Taplo Language Server via Standard I/O Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/language-server.md Launches the Taplo language server to communicate using standard input and output streams. This is useful for piping messages between processes. ```bash taplo lsp stdio ``` -------------------------------- ### Format via Standard Input/Output Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/formatting.md This command allows formatting TOML content piped from standard input and prints the formatted output to standard output. Useful for integrating with other tools or processing data streams. ```sh cat foo.toml | taplo fmt - ``` -------------------------------- ### Apply Conditional Formatting Rules Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/file.md Define rules to apply specific formatting or schema configurations based on file inclusion patterns and key scopes. Last defined rule takes precedence. ```toml [formatting] reorder_keys = false [[rule]] include = ["**/Cargo.toml"] keys = ["dependencies"] [rule.formatting] reorder_keys = true ``` -------------------------------- ### Set Formatting Options Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/file.md Configure specific formatting options within the 'formatting' table. 'align_entries' controls entry alignment. ```toml [formatting] align_entries = false ``` -------------------------------- ### Use Built-in Schema Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/file.md Configure the schema path to use a built-in Taplo schema. ```toml [schema] path = "taplo://taplo.toml" ``` -------------------------------- ### Use Remote Schema Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/file.md Configure the schema path to use a schema hosted at a remote URL. ```toml [schema] path = "https://example.com/my_schema.json" ``` -------------------------------- ### Include Files for Operations Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/file.md Specify glob patterns for files to be included in Taplo operations. Supports recursive search with globstars. ```toml include = ["Cargo.toml", "some_directory/**/*.toml"] ``` -------------------------------- ### Validate TOML with Default Schema Catalogs Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/validation.md Enable validation using default schema catalogs, such as the JSON Schema Store, for automatic schema matching. ```sh taplo check --default-schema-catalogs foo.toml ``` -------------------------------- ### Custom Syntax Colors for Dark+ Theme Source: https://github.com/tamasfe/taplo/blob/master/editors/vscode/README.md Customize TextMate rules to define specific foreground colors for array headers, arrays of tables, and date/time constants in the Dark+ theme. This helps differentiate these elements from regular keys and provides distinct styling for temporal values. ```json { "editor.tokenColorCustomizations": { "textMateRules": [ { "scope": "support.type.property-name.table", "settings": { "foreground": "#4EC9B0" } }, { "scope": "support.type.property-name.array", "settings": { "foreground": "#569CD6" } }, { "scope": "constant.other.time", "settings": { "foreground": "#DCDCAA" } } ] } } ``` -------------------------------- ### Validate TOML with Schema Catalog Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/validation.md Enable schema validation by specifying a schema catalog URL. Taplo will attempt to find and use appropriate schemas. ```sh taplo check --schema-catalog https://example.com/catalog.json foo.toml ``` -------------------------------- ### Check File Formatting Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/formatting.md Use the `--check` flag to verify if a TOML file is correctly formatted according to the configuration. This command will not modify the file; it only reports on its formatting status. ```sh taplo fmt --check foo.toml ``` -------------------------------- ### Check TOML File for Errors Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/validation.md Use the `taplo check` command to validate a TOML file for syntax and basic semantic errors. ```sh taplo check foo.toml ``` -------------------------------- ### Format File In-Place Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/formatting.md Use this command to format a specific TOML file directly. Taplo will modify the file to adhere to the configured formatting rules. ```sh taplo fmt foo.toml ``` -------------------------------- ### VS Code TOML Validation Contribution Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/developing-schemas.md Shows how a VS Code extension can contribute TOML validation rules using `regexMatch` to specify which files should be validated against a given schema URL. ```json { "contributes": { "tomlValidation": [ { "regexMatch": "^.*foo.toml$", "url": "https://json.schemastore.org/foo.json" } ] } } ``` -------------------------------- ### Force Formatting of Invalid Documents Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/formatting.md Use the `--force` flag to attempt formatting even if the TOML document contains syntax errors. This can be risky as it might lead to destructive edits on malformed files. ```sh taplo fmt --force foo.toml ``` -------------------------------- ### Specify Schema with `schema` Directive Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/directives.md Use the `schema` header directive to override the schema for a specific TOML document. Provide a relative file path or a URL to the schema file. Relative paths are resolved from the document's location. ```toml #:schema ./foo-schema.json foo = "bar" ``` -------------------------------- ### Exclude Files from Operations Source: https://github.com/tamasfe/taplo/blob/master/site/site/configuration/file.md Specify glob patterns for files to be excluded from Taplo operations. This takes precedence over the 'include' property. ```toml exclude = ["Cargo.toml"] ``` -------------------------------- ### Extract Value using Table Index Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/conversion-and-extraction.md Extracts a specific field from an array element using dot notation with an index. The output is a JSON string. ```sh taplo get -f foo.toml -o json baz.0.baz_field ``` -------------------------------- ### Extract Specific Array Element as TOML Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/conversion-and-extraction.md Extracts a specific element from an array and outputs it in TOML format. This is useful when you need to preserve the TOML structure of a subset of data. ```sh taplo get -f foo.toml baz.1 ``` -------------------------------- ### Validate TOML with Specific JSON Schema Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/validation.md Perform validation against a TOML file using a specific JSON Schema URL. ```sh taplo check --schema https://example.com/foo-schema.json foo.toml ``` -------------------------------- ### Convert TOML to JSON Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/conversion-and-extraction.md Converts a TOML file to its JSON representation. Use this to transform TOML data into a widely compatible JSON format. ```sh taplo get -f foo.toml -o json ``` -------------------------------- ### Extract All Fields from Array Elements Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/conversion-and-extraction.md Extracts a specific field from all elements within an array and returns them as a JSON array. This is useful for batch processing array data. ```sh taplo get -f foo.toml -o json baz.*.baz_field ``` -------------------------------- ### Extract Specific Value from TOML Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/conversion-and-extraction.md Extracts a specific value from a TOML file using a query expression. Note that array patterns might require shell quoting. ```sh taplo get -f foo.toml 'baz[1].baz_field' ``` -------------------------------- ### Extract Array of Objects to JSON Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/conversion-and-extraction.md Extracts a specific array of objects from a TOML file and outputs it as JSON. This is useful for processing structured array data. ```sh taplo get -f foo.toml -o json baz ``` -------------------------------- ### Extract Specific Array Element Source: https://github.com/tamasfe/taplo/blob/master/site/site/cli/usage/conversion-and-extraction.md Extracts a specific element from an array in TOML format. The output preserves the TOML structure of the selected element. ```sh taplo get -f foo.toml baz.1.baz_field ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.