aboutsummaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
authorTeddy Wing2021-06-05 14:06:38 +0200
committerTeddy Wing2021-06-05 14:06:38 +0200
commit5c34a6b4a0cb5398fbb9d72caca4de54d57189f8 (patch)
tree7d76a96af0d2594b48862324db9c671ea457fa16 /src/main.rs
parente6e0a2d816f151479ba09925493a11dbd4b36407 (diff)
downloadreflectub-5c34a6b4a0cb5398fbb9d72caca4de54d57189f8.tar.bz2
Replace hard-coded values with command line option values
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.rs b/src/main.rs
index c442392..dafc133 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -70,6 +70,12 @@ async fn run() -> anyhow::Result<()> {
process::exit(exitcode::USAGE);
}
+ let username = &opt_matches.free[0];
+ let mirror_root = &opt_matches.free[1];
+
+ let base_cgitrc = opt_matches.opt_str("cgitrc")
+ .map(|s| PathBuf::from(s));
+
let test_repos = vec![
github::Repo {
id: 345367151,
@@ -108,7 +114,7 @@ async fn run() -> anyhow::Result<()> {
for repo in test_repos {
let id = repo.id;
- let path = clone_path("/tmp", &repo);
+ let path = clone_path(&mirror_root, &repo);
let db_repo = database::Repo::from(&repo);
match db.repo_get(id).await {
@@ -124,7 +130,7 @@ async fn run() -> anyhow::Result<()> {
mirror(
&path,
&repo,
- Some(&"./cgitrc".to_owned().into()),
+ base_cgitrc.as_ref(),
).unwrap();
db.repo_insert(db_repo).await.unwrap();