dkdc-sh 0.2.0

Shell utilities for tmux, git, and command management
Documentation
  • Coverage
  • 77.78%
    21 out of 27 items documented0 out of 18 items with examples
  • Size
  • Source code size: 15.74 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.16 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2m 44s Average build duration of successful builds.
  • all releases: 1m 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • dkdc-io/sh
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • lostmygithubaccount

dkdc-sh

crates.io PyPI CI License: MIT

Shell library.

Install

cargo add dkdc-sh
uv add dkdc-sh

Usage

Rust

use dkdc_sh::{which, require, run, tmux, git};

// Command checking
if which("tmux").is_some() { /* ... */ }
require("git")?;

// Run arbitrary commands
let output = run("echo", &["hello"])?;

// 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::checkout_new_branch(&repo_dir, "feature/branch")?;
git::config_set(&repo_dir, "user.email", "bot@example.com")?;

Python

import dkdc_sh

# Command checking
path = dkdc_sh.which("tmux")
dkdc_sh.require("git")

# Run commands
output = dkdc_sh.run("echo", ["hello"])

# Tmux
dkdc_sh.tmux_new_session("my-service", "python server.py")
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")