Use clap app_from_crate

This commit is contained in:
Frank Denis 2020-08-01 17:37:58 +02:00
parent 87b06ef77d
commit 5a6d3d0b02
3 changed files with 6 additions and 8 deletions

View File

@ -1,7 +1,7 @@
[package] [package]
name = "iptoasn-webservice" name = "iptoasn-webservice"
description = "API server for iptoasn.com" description = "API server for iptoasn.com"
version = "0.2.4" version = "0.2.5"
homepage = "https://iptoasn.com" homepage = "https://iptoasn.com"
repository = "https://github.com/jedisct1/iptoasn-webservice" repository = "https://github.com/jedisct1/iptoasn-webservice"
keywords = ["ip", "asn", "bgp"] keywords = ["ip", "asn", "bgp"]

View File

@ -1,6 +1,6 @@
BSD 2-Clause License BSD 2-Clause License
Copyright (c) 2016-2019, Frank Denis Copyright (c) 2016-2020, Frank Denis
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View File

@ -1,17 +1,18 @@
#[macro_use] #[macro_use]
extern crate horrorshow; extern crate horrorshow;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
#[macro_use] #[macro_use]
extern crate router; extern crate router;
#[macro_use]
extern crate clap;
mod asns; mod asns;
mod webservice; mod webservice;
use crate::asns::*; use crate::asns::*;
use crate::webservice::*; use crate::webservice::*;
use clap::{App, Arg}; use clap::Arg;
use std::sync::{Arc, RwLock}; use std::sync::{Arc, RwLock};
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
@ -35,10 +36,7 @@ fn update_asns(asns_arc: &Arc<RwLock<Arc<ASNs>>>, db_url: &str) {
} }
fn main() { fn main() {
let matches = App::new("iptoasn webservice") let matches = app_from_crate!()
.version("0.2.0")
.author("Frank Denis")
.about("Webservice for https://iptoasn.com")
.arg( .arg(
Arg::with_name("listen_addr") Arg::with_name("listen_addr")
.short("l") .short("l")