Skip to content

[feature] Accept multiple --config paths and merge entries in the TUI #9

@JerryAgbesi

Description

@JerryAgbesi

What problem are you trying to solve?
Many users split their SSH config across several files — a personal ~/.ssh/config, a work config, per-project includes, generated files from other tooling, etc. Today skipper -c <path> takes exactly one file, so you can only browse one config source at a time. Switching context means re-running Skipper with a different -c, which defeats the purpose of having one fuzzy-searchable TUI over all your hosts.

Proposed solution
Allow -c, --config to be repeated (or accept a comma-separated list) and load all provided paths:

skipper -c ~/.ssh/config -c ~/work/.ssh/config -c ~/projects/foo/ssh_config

Behavior:

  • Parse each path with the existing sshconfig.ParseHosts and concatenate the results in the order they were passed.
  • Render the combined list in the TUI exactly as a single file is rendered today; fuzzy find spans the whole merged set.
  • When no -c is passed, fall back to the current DefaultConfigPath() behavior (single file).
  • Duplicate alias across files: surface both entries (do not silently drop), since they may differ in hostname/user/port. Consider showing the source file as a secondary label in the TUI to disambiguate — out of scope for MVP but worth noting.
  • Errors: if any one file fails to parse, fail fast with an error that names the offending path (same ergonomics as today's single-file failure).

Alternatives considered

  • Implement SSH's native Include directive support in the parser instead. That would solve part of this use case but relies on users adding Include lines to a primary config; Skipper should also work for users who want ad-hoc merging without editing their config. Not mutually exclusive — Include support could be a follow-up.
  • A persistent "tracked configs" list managed by a skipper config add <path> command, as sketched in [Feature] Multiple config Files #6. That is a larger UX surface (stateful config about configs); this issue is the smaller, stateless version that just expands the -c flag.

Additional context

  • Relates to [Feature] Multiple config Files #6 ("Multiple config Files"). [Feature] Multiple config Files #6 proposes tracking multiple config paths persistently and offering a skipper config view to list/switch them. This issue is the runtime-flag counterpart — no state, just "merge these files for this invocation." The two can coexist (persistent tracked list could become the default set of -c values), but they can ship independently. Maintainer should decide whether to close one as a subset of the other.
  • Affected code: cmd/root.go (flag registration, resolveConfigPath, runRoot), internal/sshconfig/parser.go (no change needed — called once per path).
  • Tests: extend parser_test.go with a merged-sources case, and add a cmd test for flag repetition.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions