pub fn cd_target(args: &[String]) -> &strExpand description
The directory a cd call names: its first non-option argument.
Options (-L, -P, -e, -@, …) are skipped; -- ends them, so cd -- -P goes to a
directory named -P; a lone - is the target (cd -); a bare cd has the target "".
use shellgame::session::cd_target;
let args = |list: &[&str]| list.iter().map(|a| a.to_string()).collect::<Vec<_>>();
assert_eq!(cd_target(&args(&["-P", "..", "ignored"])), "..");
assert_eq!(cd_target(&args(&["-"])), "-");
assert_eq!(cd_target(&args(&["--", "-P"])), "-P");
assert_eq!(cd_target(&args(&[])), "");