allow url format without username
This commit is contained in:
parent
b07e3062b7
commit
20926514d2
@ -1,3 +1,5 @@
|
||||
use std::io;
|
||||
use std::io::prelude::*;
|
||||
use std::fs::DirBuilder;
|
||||
use std::path::{Path, PathBuf};
|
||||
use clap::Values;
|
||||
@ -16,15 +18,16 @@ pub fn clone(remote: Values<'_>) {
|
||||
let url = remote.clone().next().unwrap();
|
||||
let (host, tmp_user, dist_path_str) = get_url_props(url);
|
||||
let username = match tmp_user {
|
||||
Some(u) => u,
|
||||
Some(u) => u.to_string(),
|
||||
None => {
|
||||
eprintln!("No username found");
|
||||
todo!();
|
||||
println!("Please enter the username of the webdav instance: ");
|
||||
let stdin = io::stdin();
|
||||
stdin.lock().lines().next().unwrap().unwrap()
|
||||
}
|
||||
};
|
||||
let api_props = ApiProps {
|
||||
host: host.clone(),
|
||||
username: username.to_string(),
|
||||
username: username,
|
||||
root: dist_path_str.to_string(),
|
||||
};
|
||||
|
||||
|
@ -36,6 +36,7 @@ pub fn push() {
|
||||
|
||||
for obj in staged_objs {
|
||||
if obj.otype == String::from("tree") {
|
||||
dbg!(("folder", obj.clone()));
|
||||
let push_factory = PushFactory.new_dir(obj.clone());
|
||||
let res = match push_factory.can_push(&mut whitelist) {
|
||||
PushState::Valid => push_factory.push(),
|
||||
@ -44,8 +45,8 @@ pub fn push() {
|
||||
_ => todo!(),
|
||||
};
|
||||
|
||||
dbg!("should push folder");
|
||||
} else {
|
||||
dbg!(("file", obj.clone()));
|
||||
let push_factory = PushFactory.new(obj.clone());
|
||||
match push_factory.can_push(&mut whitelist) {
|
||||
PushState::Valid => push_factory.push(),
|
||||
|
@ -26,6 +26,7 @@ pub enum State {
|
||||
}
|
||||
|
||||
// todo: relative path, filename, get modified
|
||||
// todo: not catch added empty folder
|
||||
pub fn status() {
|
||||
let (mut new_objs, mut del_objs) = get_diff();
|
||||
dbg!(get_diff());
|
||||
@ -51,7 +52,7 @@ pub fn get_all_staged() -> Vec<LocalObj> {
|
||||
// todo opti return folder
|
||||
let (mut new_objs, mut del_objs) = get_diff();
|
||||
let mut renamed_objs = get_renamed(&mut new_objs, &mut del_objs);
|
||||
// get copy, modified
|
||||
// todo get copy, modified
|
||||
let mut objs = new_objs;
|
||||
objs.append(&mut del_objs);
|
||||
objs.append(&mut renamed_objs);
|
||||
|
Loading…
Reference in New Issue
Block a user