fix: working on the windows cable channels

This commit is contained in:
Alex Pasmantier 2025-04-24 00:12:51 +02:00 committed by Alexandre Pasmantier
parent ae1dd99118
commit ba1c3fe8ee
6 changed files with 18 additions and 16 deletions

View File

@ -17,8 +17,10 @@ jobs:
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- name: Install fd
run: sudo apt-get install -y fd-find
- name: Run tests
run: cargo test --locked --all-features --workspace
run: cargo test --locked --all-features --workspace -- --nocapture
rustfmt:
name: Rustfmt

2
Cargo.lock generated
View File

@ -2252,7 +2252,7 @@ dependencies = [
[[package]]
name = "television-derive"
version = "0.0.26"
version = "0.0.27"
dependencies = [
"proc-macro2",
"quote",

View File

@ -31,7 +31,7 @@ build = "build.rs"
path = "television/lib.rs"
[dependencies]
television-derive = { path = "television-derive", version = "0.0.26" }
television-derive = { path = "television-derive", version = "0.0.27" }
anyhow = "1.0"
base64 = "0.22.1"

View File

@ -1,31 +1,29 @@
# Files
[[cable_channel]]
name = "files"
source_command = "Get-ChildItem -Recurse -File"
source_command = "Get-ChildItem -Recurse -File | Select-Object -ExpandProperty FullName"
preview_command = ":files:"
# Directories
[[cable_channel]]
name = "dirs"
source_command = "Get-ChildItem -Recurse -Directory"
preview_command = "Get-ChildItem -Force -LiteralPath '{}' | Format-List"
source_command = "Get-ChildItem -Recurse -Directory | Select-Object -ExpandProperty FullName"
preview_command = "ls -l {0}"
# Environment variables
[[cable_channel]]
name = "env"
source_command = "Get-ChildItem Env:"
preview_command = "$env:{0} -split ';'"
# Aliases
[[cable_channel]]
name = "aliases"
source_command = "Get-Alias"
interactive = true
# GIT
[[cable_channel]]
name = "git-repos"
source_command = "Get-ChildItem -Recurse -Directory -Force -ErrorAction SilentlyContinue | Where-Object { Test-Path \"$($_.FullName)\\.git\" } | Select-Object -ExpandProperty FullName"
source_command = "Get-ChildItem -Path 'C:\\Users' -Recurse -Directory -Force -ErrorAction SilentlyContinue | Where-Object { Test-Path \"$($_.FullName)\\.git\" } | Select-Object -ExpandProperty FullName"
preview_command = "cd '{}' ; git log -n 200 --pretty=medium --all --graph --color"
[[cable_channel]]
@ -54,12 +52,6 @@ name = "docker-images"
source_command = "docker image ls --format '{{.ID}}'"
preview_command = "docker image inspect {0} | jq -C"
# S3
[[cable_channel]]
name = "s3-buckets"
source_command = "aws s3 ls | ForEach-Object { ($_ -split '\s+')[-1] }"
preview_command = "aws s3 ls s3://{0}"
# Dotfiles (adapted to common Windows dotfile locations)
[[cable_channel]]
name = "my-dotfiles"

View File

@ -1,6 +1,6 @@
[package]
name = "television-derive"
version = "0.0.26"
version = "0.0.27"
edition = "2021"
description = "The revolution will be televised."
license = "MIT"

View File

@ -1,5 +1,8 @@
use std::process::Command;
#[cfg(not(unix))]
use tracing::warn;
use super::shell::Shell;
pub fn shell_command(interactive: bool) -> Command {
@ -17,5 +20,10 @@ pub fn shell_command(interactive: bool) -> Command {
cmd.arg("-i");
}
#[cfg(not(unix))]
if interactive {
warn!("Interactive mode is not supported on Windows.");
}
cmd
}