Skip to main content

Command line INI editor

Project description

DIG ini-editor

Build Status Build tests PyPI - License PyPI - Python Version PyPI - Version

Windows - Supported Linux - Supported MacOS - Supported

Simple command line INI editor.

  • Get list of sections
  • Get list of keys from section
  • Get value of key from section
  • Add/Edit value of key from section
  • Delete key from section
  • Delete entire section
  • Check if section exists
  • Check if section and key exists

By default, all output will be written into stdout. It can be changed with option --output FILENAME or --in-place wich will use the input file as output.

The input filename "-" is reserved to read from stdin (cat file.ini | ini-editor ACTION - …)

Usage

python -m dig_ini_editor ACTION

or

ini-editor ACTION

ACTION must be one of:

get

ini-editor get filename [section [key]]
  • If section is not set, will return a list of sections.
  • If key is not set, will return a list of keys from section.
  • Otherwise will return the value of key from section.

set

ini-editor set filename section key value

Will add or replace, with value, the value of key from section.

delete

ini-editor delete filename section [key]
  • If key is not set, will remove entire section.
  • Otherwise will remove only the key from section.

exists

ini-editor exists filename section [key]

Will return "true" and exit code 0 if the condition is satisfied, otherwise return "false" and exit code non-zero.

  • If key is not set, will only check if section exists.

Installation

From PyPI (preferred):

python -m pip install dig-ini-editor

From github release:

python -m pip install "https://github.com/DIG-/python-ini-editor/releases/download/1.0.1/dig_ini_editor-1.0.1-py3-none-any.whl"

or

python -m pip install "https://github.com/DIG-/python-ini-editor/releases/download/1.0.1/dig_ini_editor.tar.gz"

From github main branch:

python -m pip install "git+https://github.com/DIG-/python-ini-editor.git@master#egg=dig_git_ignore"

License

CC BY-ND 4.0

  • You can use and redist freely.
  • You can also modify, but only for yourself.
  • You can use it as a part of your project, but without modifications in this project.

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

dig-ini-editor-1.0.1.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

dig_ini_editor-1.0.1-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

Supported by

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