Add URL check before adding the "url" to the store
This commit is contained in:
parent
406348bc34
commit
c1d497fa6a
2 changed files with 10 additions and 0 deletions
|
@ -6,6 +6,7 @@
|
||||||
#[macro_use] extern crate uuid;
|
#[macro_use] extern crate uuid;
|
||||||
#[macro_use] extern crate regex;
|
#[macro_use] extern crate regex;
|
||||||
#[macro_use] extern crate prettytable;
|
#[macro_use] extern crate prettytable;
|
||||||
|
extern crate url;
|
||||||
extern crate config;
|
extern crate config;
|
||||||
|
|
||||||
use cli::CliConfig;
|
use cli::CliConfig;
|
||||||
|
|
|
@ -18,7 +18,16 @@ use clap::ArgMatches;
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
|
|
||||||
pub fn add_command(module: &Module, env: CommandEnv) -> CommandResult {
|
pub fn add_command(module: &Module, env: CommandEnv) -> CommandResult {
|
||||||
|
use url::Url;
|
||||||
|
|
||||||
let url = env.matches.value_of("url").unwrap();
|
let url = env.matches.value_of("url").unwrap();
|
||||||
|
|
||||||
|
if let Err(e) = Url::parse(url) {
|
||||||
|
info!("Not an URL: '{}'", url);
|
||||||
|
info!(" this will turn into an hard error before 0.1.0");
|
||||||
|
debug!("URL parsing error: {:?}", e);
|
||||||
|
}
|
||||||
|
|
||||||
let tags = get_tags(env.rt, env.matches);
|
let tags = get_tags(env.rt, env.matches);
|
||||||
info!("Adding url '{}' with tags '{:?}'", url, tags);
|
info!("Adding url '{}' with tags '{:?}'", url, tags);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue