Shell utilities for tmux, git, and command management
Project description
dkdc-sh
Shell library.
Install
cargo add dkdc-sh
uv add dkdc-sh
Usage
Rust
use dkdc_sh::{which, require, run, run_with_env, tmux, git};
// Command checking
if which("tmux").is_some() { /* ... */ }
require("git")?;
// Run arbitrary commands
let output = run("echo", &["hello"])?;
// Run with custom environment variables
let output = run_with_env("cargo", &["build"], &[("RUSTFLAGS", "-D warnings")])?;
// Tmux session management
tmux::new_session("my-service", "python server.py")?;
tmux::send_keys("my-service", "reload")?;
let logs = tmux::capture_pane("my-service", Some(50))?;
tmux::kill_session("my-service")?;
// Git operations
git::clone_shallow("https://github.com/org/repo.git", &dest, "main")?;
git::clone_shallow_with_env(
"https://github.com/org/repo.git", &dest, "main",
&[("GIT_SSH_COMMAND", "ssh -i ~/.ssh/deploy_key")],
)?;
git::checkout_new_branch(&repo_dir, "feature/branch")?;
git::config_set(&repo_dir, "user.email", "bot@example.com")?;
let log = git::cmd_with_env(&repo_dir, &["log", "--oneline"], &[("GIT_PAGER", "cat")])?;
Python
import dkdc_sh
# Command checking
path = dkdc_sh.which("tmux")
dkdc_sh.require("git")
# Run commands
output = dkdc_sh.run("echo", ["hello"])
# Run with custom environment variables
output = dkdc_sh.run("cargo", ["build"], env=[("RUSTFLAGS", "-D warnings")])
# Tmux
dkdc_sh.tmux_new_session("my-service", "python server.py")
dkdc_sh.tmux_send_keys("my-service", "reload")
logs = dkdc_sh.tmux_capture_pane("my-service", lines=50)
dkdc_sh.tmux_kill_session("my-service")
# Git
dkdc_sh.git_clone_shallow("https://github.com/org/repo.git", "./dest", "main")
dkdc_sh.git_checkout_new_branch("./repo", "feature/branch")
output = dkdc_sh.git_cmd("./repo", ["log", "--oneline"])
Error handling
Rust
The library uses a unified Error enum:
| Variant | Description |
|---|---|
CommandNotFound |
Command not found in PATH |
CommandFailed |
Non-zero exit code (includes stderr) |
Tmux |
Tmux-specific errors |
Io |
IO errors |
Python
All errors are raised as RuntimeError.
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
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dkdc_sh-0.2.1.tar.gz.
File metadata
- Download URL: dkdc_sh-0.2.1.tar.gz
- Upload date:
- Size: 9.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14233f5fee662fa23a7be09b47b8f73cd36db0221b88b40dc5e9a26ae037d8bf
|
|
| MD5 |
f7aa6f46c998737dac1728923aacfee8
|
|
| BLAKE2b-256 |
283a2def0e1949edc31430e7dff0a8244cb563c73dea4152521a7605ec219be6
|
Provenance
The following attestation bundles were made for dkdc_sh-0.2.1.tar.gz:
Publisher:
release-python.yml on dkdc-io/sh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dkdc_sh-0.2.1.tar.gz -
Subject digest:
14233f5fee662fa23a7be09b47b8f73cd36db0221b88b40dc5e9a26ae037d8bf - Sigstore transparency entry: 1237992841
- Sigstore integration time:
-
Permalink:
dkdc-io/sh@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/dkdc-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_x86_64.whl.
File metadata
- Download URL: dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_x86_64.whl
- Upload date:
- Size: 296.9 kB
- Tags: CPython 3.11+, manylinux: glibc 2.39+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8672bcc9e5e638a5ef08b7c7f5e82a09c767f300562f766369e090b19628a62f
|
|
| MD5 |
8585a96b87b432fc27a7e64365b63f5a
|
|
| BLAKE2b-256 |
43525a4e0d9ed6a5c933fe237761c763af9dc5f4e9072cf50628802e2b655f41
|
Provenance
The following attestation bundles were made for dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_x86_64.whl:
Publisher:
release-python.yml on dkdc-io/sh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_x86_64.whl -
Subject digest:
8672bcc9e5e638a5ef08b7c7f5e82a09c767f300562f766369e090b19628a62f - Sigstore transparency entry: 1237992850
- Sigstore integration time:
-
Permalink:
dkdc-io/sh@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/dkdc-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_aarch64.whl.
File metadata
- Download URL: dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_aarch64.whl
- Upload date:
- Size: 287.9 kB
- Tags: CPython 3.11+, manylinux: glibc 2.39+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7325651ffae1ef3ccdbf8d8f56f87fd6e5fe43c7a9a3acf3b5861a556b991d4f
|
|
| MD5 |
ecbd77325f1803cecbba76ee6838dff4
|
|
| BLAKE2b-256 |
9ddc7033f6920c476cdb0f7a567514dda1e179bd2d16f9144cf52b455261b3f6
|
Provenance
The following attestation bundles were made for dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_aarch64.whl:
Publisher:
release-python.yml on dkdc-io/sh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dkdc_sh-0.2.1-cp311-abi3-manylinux_2_39_aarch64.whl -
Subject digest:
7325651ffae1ef3ccdbf8d8f56f87fd6e5fe43c7a9a3acf3b5861a556b991d4f - Sigstore transparency entry: 1237992875
- Sigstore integration time:
-
Permalink:
dkdc-io/sh@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/dkdc-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dkdc_sh-0.2.1-cp311-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: dkdc_sh-0.2.1-cp311-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 252.8 kB
- Tags: CPython 3.11+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d779c01acd534ed0420cf608ef86d6f09f7aa50124ba2bb36511433255b3d228
|
|
| MD5 |
967d94146676348cbdf9f4659ffe657b
|
|
| BLAKE2b-256 |
589215bfd036cc5e7138d9449ab1d7aa8648141e3cd70e72cfe8784226875371
|
Provenance
The following attestation bundles were made for dkdc_sh-0.2.1-cp311-abi3-macosx_11_0_arm64.whl:
Publisher:
release-python.yml on dkdc-io/sh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dkdc_sh-0.2.1-cp311-abi3-macosx_11_0_arm64.whl -
Subject digest:
d779c01acd534ed0420cf608ef86d6f09f7aa50124ba2bb36511433255b3d228 - Sigstore transparency entry: 1237992888
- Sigstore integration time:
-
Permalink:
dkdc-io/sh@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/dkdc-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Trigger Event:
push
-
Statement type:
File details
Details for the file dkdc_sh-0.2.1-cp311-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: dkdc_sh-0.2.1-cp311-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 261.1 kB
- Tags: CPython 3.11+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7d63f221f0b2da7f7777a1e63bda532edc6a89e10b2f2c40fcea7bb9e3041603
|
|
| MD5 |
548c68519db3c88c196fba8d6e538d43
|
|
| BLAKE2b-256 |
67b39ea0c12c32d35b63a4903b8a5f6f165e9af6b55bb979d5935dc8415a304f
|
Provenance
The following attestation bundles were made for dkdc_sh-0.2.1-cp311-abi3-macosx_10_12_x86_64.whl:
Publisher:
release-python.yml on dkdc-io/sh
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
dkdc_sh-0.2.1-cp311-abi3-macosx_10_12_x86_64.whl -
Subject digest:
7d63f221f0b2da7f7777a1e63bda532edc6a89e10b2f2c40fcea7bb9e3041603 - Sigstore transparency entry: 1237992866
- Sigstore integration time:
-
Permalink:
dkdc-io/sh@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/dkdc-io
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release-python.yml@25fa6e6e4835d80b4264fb7847d01ea9ba54c182 -
Trigger Event:
push
-
Statement type: