You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/main.rs
+17-8Lines changed: 17 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -114,11 +114,17 @@ fn main() {
114
114
115
115
let matches = app.clone().get_matches();
116
116
117
-
fnget_gpm_root(rc:&Preset) -> &str{
117
+
fncheck_gpm_root(rc:&Preset){
118
118
if rc.root.is_empty(){
119
-
println!("Can not found root folder in the configure for clone.\nTry running the following command to add a default folder:\n\n gpm config add root $HOME/gpm\n\nOr set to a custom folder:\n\n gpm config add root <folder>\n");
119
+
println!("Can not found root folder in the configure.\nTry running the following command to add a default folder:\n\n gpm config add root $HOME/gpm\n\nOr set to a custom folder:\n\n gpm config add root <folder>\n");
120
120
process::exit(0x1);
121
-
}elseif rc.root.len() == 1{
121
+
}
122
+
}
123
+
124
+
fnget_gpm_root(rc:&Preset) -> &str{
125
+
check_gpm_root(rc);
126
+
127
+
if rc.root.len() == 1{
122
128
let s = &rc.root[0].as_str();
123
129
s
124
130
}else{
@@ -340,12 +346,15 @@ fn main() {
340
346
fs::write(gpm_rc, serialized).expect("can not write to $HOME/.gpmrc");
341
347
}
342
348
Some(("list", _)) => {
343
-
let gpm_root:&str = get_gpm_root(&rc);
344
-
let root = Path::new(gpm_root);
345
-
let repositories = walk::walk_root(root).unwrap();
349
+
check_gpm_root(&rc);
346
350
347
-
for v in repositories {
348
-
println!("{}", v.as_os_str().to_str().unwrap())
351
+
for gpm_root in rc.root{
352
+
let root = Path::new(&gpm_root);
353
+
let repositories = walk::walk_root(root).unwrap();
0 commit comments