Skip to content

Commit 45ae713

Browse files
authored
Merge pull request #96 from PLUS-POSTECH/prepare-list-support
Introduce Problem struct to distinguish problems and repositories
2 parents e2dff01 + 74aeef1 commit 45ae713

File tree

21 files changed

+530
-270
lines changed

21 files changed

+530
-270
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ url = "1.7.2"
2929
whoami = "0.4.1"
3030

3131
[dev-dependencies]
32+
matches = "0.1.8"
3233
serde_test = "1.0.85"
3334

3435
[lib]

src/bin/soma/commands/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl SomaCommand for BuildCommand {
2424
.arg(
2525
Arg::with_name("problem")
2626
.required(true)
27-
.help("the name of the problem"),
27+
.help("problem name with optional repository name prefix"),
2828
)
2929
}
3030

src/bin/soma/commands/clean.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl SomaCommand for CleanCommand {
2424
.arg(
2525
Arg::with_name("problem")
2626
.required(true)
27-
.help("the name of the problem to clean up"),
27+
.help("problem name with optional repository name prefix"),
2828
)
2929
}
3030

src/bin/soma/commands/fetch.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ impl SomaCommand for FetchCommand {
2626
.arg(
2727
Arg::with_name("problem")
2828
.required(true)
29-
// TODO: Separate problem name from repository name.
3029
.help("problem name with optional repository name prefix"),
3130
)
3231
}

src/bin/soma/commands/list.rs

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,25 @@ impl SomaCommand for ListCommand {
3232
if let None = repo_iter.peek() {
3333
env.printer().write_line("No repository was added.");
3434
} else {
35-
env.printer()
36-
.write_line(&format!("{:<20}{:<40}", "Name", "Origin"));
37-
3835
for repository in repo_iter {
3936
env.printer().write_line(&format!(
40-
"{:<20}{:<40}",
37+
"{} ({})",
4138
repository.name(),
4239
repository.backend()
4340
));
41+
42+
let mut peekable = repository.prob_name_iter().peekable();
43+
while let Some(name) = peekable.next() {
44+
env.printer().write_line(&format!(
45+
"{}─ {}",
46+
if peekable.peek().is_none() {
47+
"└"
48+
} else {
49+
"├"
50+
},
51+
name
52+
))
53+
}
4454
}
4555
}
4656

src/bin/soma/commands/run.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl SomaCommand for RunCommand {
2424
.arg(
2525
Arg::with_name("problem")
2626
.required(true)
27-
.help("the name of the problem"),
27+
.help("problem name with optional repository name prefix"),
2828
)
2929
.arg(
3030
Arg::with_name("port")

src/bin/soma/commands/stop.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ impl SomaCommand for StopCommand {
2424
.arg(
2525
Arg::with_name("problem")
2626
.required(true)
27-
.help("the name of the problem to stop"),
27+
.help("problem name with optional repository name prefix"),
2828
)
2929
}
3030

src/bin/soma/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ mod terminal_printer;
1717

1818
fn cli_env(data_dir: &mut DataDirectory) -> SomaResult<Environment<impl Connect, TerminalPrinter>> {
1919
Environment::new(
20-
username(),
20+
username().to_lowercase(),
2121
data_dir,
2222
connect_default()?,
2323
TerminalPrinter::new(),

0 commit comments

Comments
 (0)