Skip to content

feat: Add --no-prefix option to disable hostname prefix in output (pdsh -N compatibility)#101

Merged
inureyes merged 2 commits intomainfrom
feat/no-prefix-option
Dec 16, 2025
Merged

feat: Add --no-prefix option to disable hostname prefix in output (pdsh -N compatibility)#101
inureyes merged 2 commits intomainfrom
feat/no-prefix-option

Conversation

@inureyes
Copy link
Member

@inureyes inureyes commented Dec 16, 2025

Summary

  • Add --no-prefix / -N option that disables hostname prefix in output lines
  • Provides pdsh compatibility for the -N flag
  • Works in stream mode (--stream) and file output mode (--output-dir)
  • Useful for programmatic parsing or cleaner display

Changes

Implementation

  • Add --no-prefix / -N option to CLI struct in src/cli.rs
  • Add no_prefix field to ExecuteCommandParams
  • Modify OutputMode to track no_prefix setting for Stream and File modes
  • Update NodeOutputWriter to conditionally format output with/without prefix
  • Thread no_prefix option through ParallelExecutor streaming handlers

Tests

  • Add unit tests for no_prefix functionality in output_sync.rs and output_mode.rs
  • Add CLI parsing tests for --no-prefix/-N option (10 test cases) in tests/no_prefix_test.rs

Documentation

  • Update README.md with --no-prefix in Command-Line Options section
  • Update README.md Stream Mode section with --no-prefix usage example
  • Update manpage (bssh.1) with --no-prefix/-N option documentation

Usage

# Default behavior (with prefix)
bssh -H "node1,node2" "uname -a"
# Output:
# [node1] Linux node1 5.15.0
# [node2] Linux node2 5.15.0

# With --no-prefix
bssh -H "node1,node2" --no-prefix "uname -a"
# Output:
# Linux node1 5.15.0
# Linux node2 5.15.0

# With --stream mode
bssh -C production --stream --no-prefix "tail -f /var/log/syslog"

Test plan

  • Build passes without errors
  • All existing tests pass (232+ tests)
  • New unit tests added for no_prefix functionality
  • New CLI parsing tests added (10 test cases)
  • --help shows the new option correctly
  • README.md updated with option documentation
  • Manpage updated with option documentation

Closes #92

…sh -N compatibility)

Add a new --no-prefix / -N option that disables the hostname prefix in
command output lines. This is useful for programmatic parsing or cleaner
display, and provides compatibility with pdsh's -N option.

Changes:
- Add --no-prefix / -N option to CLI struct in src/cli.rs
- Add no_prefix field to ExecuteCommandParams
- Modify OutputMode to track no_prefix setting for Stream and File modes
- Update NodeOutputWriter to conditionally format output with/without prefix
- Thread no_prefix option through ParallelExecutor streaming handlers
- Add unit tests for no_prefix functionality

Closes #92
- Add CLI parsing tests for --no-prefix/-N option (10 test cases)
- Update README.md with --no-prefix in Command-Line Options section
- Update README.md Stream Mode section with --no-prefix usage example
- Update manpage (bssh.1) with --no-prefix/-N option documentation

Tests cover:
- Long and short option parsing
- Default value (false)
- Combination with --stream mode
- Combination with --output-dir mode
- Combination with cluster option
- Combination with other CLI options
- OutputMode is_no_prefix() behavior for all modes
@inureyes inureyes self-assigned this Dec 16, 2025
@inureyes inureyes added type:enhancement New feature or request status:review Under review priority:low Low priority issue pdsh-compat pdsh compatibility mode features labels Dec 16, 2025
@inureyes inureyes merged commit 527304b into main Dec 16, 2025
3 checks passed
@inureyes inureyes deleted the feat/no-prefix-option branch December 16, 2025 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pdsh-compat pdsh compatibility mode features priority:low Low priority issue status:review Under review type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: Add --no-prefix option to disable hostname prefix in output (pdsh -N compatibility)

1 participant