Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
cat "$TOML"

- name: Publish bashkit to crates.io
run: cargo publish -p bashkit --allow-dirty
run: cargo publish -p bashkit --allow-dirty 2>&1 || echo "::warning::bashkit publish failed (may already exist)"
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}

Expand All @@ -70,11 +70,13 @@ jobs:
- name: Wait for crates.io index update
run: sleep 30

- name: Strip python feature from bashkit-cli dependency
- name: Strip python feature from bashkit-cli
# python feature is stripped from bashkit during publish (monty is git-only)
run: |
TOML=crates/bashkit-cli/Cargo.toml
sed -i 's/features = \["http_client", "git", "python"\]/features = ["http_client", "git"]/' "$TOML"
# Remove python feature and default that references it
sed -i '/^python = \["bashkit\/python"\]/d' "$TOML"
sed -i 's/default = \["python"\]/default = []/' "$TOML"
echo "--- bashkit-cli Cargo.toml after stripping ---"
cat "$TOML"

Expand Down
6 changes: 5 additions & 1 deletion crates/bashkit-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@ name = "bashkit"
path = "src/main.rs"
doc = false # Disable to avoid collision with bashkit library docs

[features]
default = ["python"]
python = ["bashkit/python"]

[dependencies]
bashkit = { path = "../bashkit", version = "0.1.9", features = ["http_client", "git", "python"] }
bashkit = { path = "../bashkit", version = "0.1.9", features = ["http_client", "git"] }
tokio.workspace = true
clap.workspace = true
anyhow.workspace = true
Expand Down
6 changes: 5 additions & 1 deletion crates/bashkit-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ struct Args {
no_git: bool,

/// Disable python builtin (monty backend)
#[arg(long)]
#[cfg_attr(not(feature = "python"), arg(long, hide = true))]
#[cfg_attr(feature = "python", arg(long))]
no_python: bool,

#[command(subcommand)]
Expand All @@ -65,6 +66,7 @@ fn build_bash(args: &Args) -> bashkit::Bash {
builder = builder.git(bashkit::GitConfig::new());
}

#[cfg(feature = "python")]
if !args.no_python {
builder = builder.python();
}
Expand Down Expand Up @@ -143,6 +145,7 @@ mod tests {
assert!(!args.no_python);
}

#[cfg(feature = "python")]
#[tokio::test]
async fn python_enabled_by_default() {
let args = Args::parse_from(["bashkit", "-c", "python --version"]);
Expand All @@ -151,6 +154,7 @@ mod tests {
assert_ne!(result.stderr, "python: command not found\n");
}

#[cfg(feature = "python")]
#[tokio::test]
async fn python_can_be_disabled() {
let args = Args::parse_from(["bashkit", "--no-python", "-c", "python --version"]);
Expand Down
Loading