Squashed (migration)
(initial) Align formatting and code style to project standards. Add live_test.sh: full automated integration suite against a real SSH server Show [name] for optional positionals, allow filtering import by name too Fix transfer rough edges: value-name hint, identity warnings, single-profile export Add transfer subcommand for bulk profile export/import Harden forced ssh flags: accept-new host keys, block multiplexing, tighten identity auth release build opts Standardize error messages, formatting, and code style. Refine --help text for consistency. Update comments for clarity and tone alignment. Normalize user-facing --help text for tone/format consistency Show real mapping grammar in --help, make --via repeatable, trim comments Match vmic's custom top-level --help renderer Implement porthole v0.1: profiles, supervised open/close, reconnect Fix --via/-J grammar and --force process-group kill added .gitignore
This commit is contained in:
22
src/commands/add.rs
Normal file
22
src/commands/add.rs
Normal file
@@ -0,0 +1,22 @@
|
||||
use crate::cli::AddArgs;
|
||||
use crate::commands::edits_from_mapping;
|
||||
use crate::error::{PortholeError, Result};
|
||||
use crate::profile::{self, Profile};
|
||||
use crate::ui;
|
||||
|
||||
pub fn run(args: AddArgs) -> Result<()> {
|
||||
profile::require_valid_name(&args.name)?;
|
||||
let name = profile::normalize(&args.name);
|
||||
|
||||
if profile::exists(&name) {
|
||||
return Err(PortholeError::AlreadyExists(name));
|
||||
}
|
||||
|
||||
let edits = edits_from_mapping(&args.mapping);
|
||||
let new_profile = Profile::new(name.clone(), &edits)?;
|
||||
profile::save(&new_profile)?;
|
||||
|
||||
ui::ok(&format!("Saved profile '{name}' ({} {}).", new_profile.kind.label(), new_profile.mapping));
|
||||
println!(" Run 'porthole open {name}' to start it.");
|
||||
Ok(())
|
||||
}
|
||||
Reference in New Issue
Block a user