sde

Structured data editor for CLI

https://github.com/dvershinin/sde

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (10.3%) to scientific vocabulary

Keywords

cli editor json sed utility yaml yml
Last synced: 6 months ago · JSON representation

Repository

Structured data editor for CLI

Basic Info
  • Host: GitHub
  • Owner: dvershinin
  • License: bsd-2-clause
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 47.9 KB
Statistics
  • Stars: 18
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 20
Topics
cli editor json sed utility yaml yml
Created over 4 years ago · Last pushed almost 2 years ago
Metadata Files
Readme Funding License

README.md

sde

PyPI version

sde is not sed. It's a structured data editor for CLI.

Why?

Many people asked for a simple JSON in-place editing and jq was the solution:

bash jq '.address = "abcde"' test.json|sponge test.json

Does this seem readable or elegant to you?

How about this instead:

bash sde address abcde test.json

sde is not a substitute for jq or sed.

It allows simple in-place JSON/YAML value changes, for structured data.

Sample JSON

json { "name":"John", "age":31, "city":"New York", "extra": { "gender": null } }

Sample YAML

yaml database: user: example password: secret

Modify data

bash sde name Jack data.json sde extra.gender male data.json sde database.user john data.yml

It is possible to modify data in arrays using a dotted notation. Let's take another sample:

json { "users": [ { "username": "foo", "enabled": true }, { "username": "bar", "enabled": true } ], }

We can set the first user's enabled property to false:

bash sde users.0.enabled false data.json

Installation for CentOS/RHEL 7, 8 or Amazon Linux 2, or Fedora Linux

bash sudo yum -y install https://extras.getpagespeed.com/release-latest.rpm sudo yum -y install sde

Installation for other systems

Installing with pip is easiest:

bash pip install sde

Notes

Quoting in JSON

Quoting is avoided for null, true, false, and numeric values. To ensure that a given value is quoted, use -s (or --string) option:

bash sde -s key null file.json

Force-fail on missing keys

If you must edit the file, by ensuring to update only the existing key, use -e (--must-exist) option. The program will exit without adding the key which doesn't exist.

bash sde -e key val file.json

Force-fail on unchanged file

If the data is unchanged after running sde (values already match), you can force a failure exit code 2 by passing the -m option:

```bash sde -m key sameval file.json

> exit code 0

sde -m key sameval file.json

> exit code 2

```

TODO

Work with stdin

bash echo $json | sde name Jack

Query simple data

bash sdg name data.json

Owner

  • Name: Danila Vershinin
  • Login: dvershinin
  • Kind: user
  • Location: 127.0.0.1
  • Company: @GetPageSpeed

Python, NGINX, and RPM enthusiast.

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Committers

Last synced: 10 months ago

All Time
  • Total Commits: 49
  • Total Committers: 2
  • Avg Commits per committer: 24.5
  • Development Distribution Score (DDS): 0.041
Past Year
  • Commits: 2
  • Committers: 1
  • Avg Commits per committer: 2.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Danila Vershinin c****z@g****m 47
Rich Rauenzahn r****a@g****m 2

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 8
  • Total pull requests: 2
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 17 hours
  • Total issue authors: 6
  • Total pull request authors: 1
  • Average comments per issue: 1.63
  • Average comments per pull request: 1.0
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • jrbray1 (2)
  • rrauenza (2)
  • dvershinin (1)
  • djuloori (1)
  • Muchaszewski (1)
  • jgarbers (1)
Pull Request Authors
  • rrauenza (2)
Top Labels
Issue Labels
wontfix (3)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 380 last-month
  • Total docker downloads: 9
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 16
  • Total maintainers: 1
pypi.org: sde

A CLI tool to edit simple JSON and YAML data files

  • Versions: 16
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 380 Last month
  • Docker Downloads: 9
Rankings
Docker downloads count: 4.2%
Dependent packages count: 10.0%
Downloads: 14.6%
Average: 14.7%
Stargazers count: 14.8%
Dependent repos count: 21.7%
Forks count: 22.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

requirements.txt pypi
  • pyyaml *
  • six *
setup.py pypi
  • pyyaml *
  • six *
.github/workflows/codeql-analysis.yml actions
  • actions/checkout v2 composite
  • github/codeql-action/analyze v1 composite
  • github/codeql-action/autobuild v1 composite
  • github/codeql-action/init v1 composite
.github/workflows/pythonpackage.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v2 composite
.github/workflows/pythonpublish.yml actions
  • actions/checkout v1 composite
  • actions/setup-python v1 composite