handle_single_input_argument

Function handle_single_input_argument 

Source
pub(crate) fn handle_single_input_argument(arg: &str) -> Result<()>
Expand description

Handles a single input argument, either a GitHub PR URL or a branch name, and switches to the corresponding branch.

Behaviour:

  • If arg parses as a GitHub PR URL, authenticate then derive the branch name and switch to it.
  • Otherwise, use arg as the branch name and switch to it.

ยงErrors

  • GitHub authentication via [ytil_gh::log_into_github] fails (if URL).
  • Pull request branch name derivation via [ytil_gh::get_branch_name_from_url] fails (if URL).
  • Branch switching via [ytil_git::branch::switch] fails.