Skip to main content

A command-line tool for removing specified fields from YAML files.

Project description

YamlStripper

YamlStripper is a Python command-line tool for removing specified fields from YAML files.

Installation

To use YamlStripper, you need to have Python 3 installed on your computer. You can download and install Python 3 from the official Python website: https://www.python.org/downloads/

After installing Python 3, you can install YamlStripper using pip, the Python package manager:

pip install yaml-stripper

Usage

To use YamlStripper, open a command prompt or terminal window and type the following command:

yaml-stripper input_file output_file -f field1 field2 ...

where:

  • input_file - The input YAML file to remove fields from.
  • output_file - The output YAML file without the specified fields.
  • -f field1 field2 ... - The fields to remove from the input YAML file.

For example, if you have a YAML file called example.yaml with the following contents:

name: John
age: 30
email: john@example.com
phone: 123-456-7890

and you want to remove the email and phone fields from this YAML file and save the result in a new file called stripped.yaml, you can use the following command:

yaml-stripper example.yaml stripped.yaml -f email phone

After running the command, a new file called stripped.yaml will be created with the following contents:

name: John
age: 30

Examples

Here are some more examples of how to use YamlStripper:

Example 1

Suppose you have a YAML file called data.yaml with the following contents:

name: Alice
age: 25
email: alice@example.com
phone: 987-654-3210
address:
  street: 123 Main St
  city: Anytown
  state: CA
  zip: 12345

You want to remove the email and phone fields from this YAML file and save the result in a new file called stripped.yaml. Here's how you can use YamlStripper to achieve this:

yaml-stripper data.yaml stripped.yaml -f email phone

After running the command, a new file called stripped.yaml will be created with the following contents:

name: Alice
age: 25
address:
  street: 123 Main St
  city: Anytown
  state: CA
  zip: 12345

Example 2

Suppose you have a YAML file called config.yaml with the following contents:

debug: true
port: 8000
database:
  host: localhost
  port: 5432
  name: mydb
  user: myuser
  password: mypass

You want to remove the debug field from this YAML file and save the result in a new file called stripped.yaml. Here's how you can use YamlStripper to achieve this:

yaml-stripper config.yaml stripped.yaml -f debug

After running the command, a new file called stripped.yaml will be created with the following contents:

port: 8000
database:
  host: localhost
  port: 5432
  name: mydb
  user: myuser
 

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yaml-stripper-0.1.17.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yaml_stripper-0.1.17-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file yaml-stripper-0.1.17.tar.gz.

File metadata

  • Download URL: yaml-stripper-0.1.17.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for yaml-stripper-0.1.17.tar.gz
Algorithm Hash digest
SHA256 c09c71271bf27381b653cb927b6261e67af2e2da87e9355dc41dbc5422934c1d
MD5 0ff0e3b15030e11e072d71d7a37d7cc8
BLAKE2b-256 08f1607f314c470a47ea6259a0705fea9303cda4a3a96f1269c550d120f027cc

See more details on using hashes here.

File details

Details for the file yaml_stripper-0.1.17-py3-none-any.whl.

File metadata

  • Download URL: yaml_stripper-0.1.17-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for yaml_stripper-0.1.17-py3-none-any.whl
Algorithm Hash digest
SHA256 8f6656ef3688f5e9d3c00a01ccbdbce6090869b8eee51287ccc7a8145b5d0b9d
MD5 acb4b297ef3c9211c31f7ad936d5dc68
BLAKE2b-256 7907571550d0fdc4abf432a6406f9b868c66a24dba841e842473586903551e72

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page