Skip to content

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

@inureyes

Description

@inureyes

Summary

Add a new --no-prefix option to bssh that disables the hostname prefix in command output. This is a prerequisite for pdsh compatibility mode (meta-issue #91).

Parent Issue

Part of #91 (pdsh compatibility mode) - Phase 1: New Options for Feature Parity

Background

By default, bssh prefixes each line of output with the hostname to identify which node produced it:

[node1] Linux node1 5.15.0
[node2] Linux node2 5.15.0

pdsh provides -N option to disable this prefix, which is useful when:

  • Parsing output programmatically
  • Output is already self-identifying
  • Cleaner display for single-node operations

Proposed Implementation

CLI Interface

# 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

Option Definition

#[arg(
    short = 'N',
    long = "no-prefix",
    help = "Disable hostname prefix in output lines\nUseful for programmatic parsing or cleaner display"
)]
pub no_prefix: bool,

Implementation Tasks

  • Add --no-prefix / -N option to Cli struct in src/cli.rs
  • Modify output formatting in src/ui.rs to respect this flag
  • Ensure it works with all output modes (stream, TUI, normal)
  • Add unit tests
  • Update help text and examples

Acceptance Criteria

  • --no-prefix removes [hostname] prefix from all output lines
  • Works in stream mode (--stream)
  • Works in normal output mode
  • Works with output file mode (--output-dir) - file naming should still include hostname
  • Does not affect TUI mode (TUI has its own display format)

Notes

  • Short option -N does not conflict with existing bssh options
  • Consider if this should also affect stderr output (probably yes)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions