Make repo optional

This commit is contained in:
Joscha 2023-08-09 14:13:17 +02:00
parent a261bfdd26
commit 04212dff1c
4 changed files with 28 additions and 13 deletions

View file

@ -102,8 +102,11 @@ impl ConfigFile {
return Ok(name.clone());
}
if let Command::Server(ServerCommand { repo, .. }) = &args.command {
if let Some(name) = repo.canonicalize()?.file_name() {
if let Command::Server(ServerCommand {
repo: Some(path), ..
}) = &args.command
{
if let Some(name) = path.canonicalize()?.file_name() {
let name = name.to_string_lossy();
let name = name.strip_suffix(".git").unwrap_or(&name).to_string();
return Ok(name);