Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
url-checker
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Romain Courteaud
url-checker
Commits
0216bd84
Commit
0216bd84
authored
Dec 06, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cli: simplify command line
parent
9d1c4e37
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
urlchecker_cli.py
urlchecker_cli.py
+12
-9
No files found.
urlchecker_cli.py
View file @
0216bd84
...
...
@@ -2,13 +2,11 @@ import click
import
sys
from
urlchecker_bot
import
create_bot
@
click
.
group
()
def
runUrlChecker
():
pass
@
runUrlChecker
.
command
(
"bot"
,
short_help
=
"Runs url checker bot."
)
@
click
.
command
(
short_help
=
"Runs url checker bot."
)
@
click
.
option
(
'--run'
,
'-r'
,
help
=
"The bot operation to run."
,
show_default
=
True
,
default
=
'status'
,
type
=
click
.
Choice
([
'crawl'
,
'status'
]))
@
click
.
option
(
"--sqlite"
,
"-s"
,
help
=
"The path of the sqlite DB. (default: :memory:)"
)
...
...
@@ -18,7 +16,7 @@ def runUrlChecker():
@
click
.
option
(
"--configuration"
,
"-f"
,
help
=
"The path of the configuration file."
)
def
run
WebBot
(
sqlite
,
dns
,
url
,
domain
,
configuration
):
def
run
UrlChecker
(
run
,
sqlite
,
dns
,
url
,
domain
,
configuration
):
# click.echo("Running url checker bot")
mapping
=
{}
...
...
@@ -34,7 +32,12 @@ def runWebBot(sqlite, dns, url, domain, configuration):
if
dns
:
mapping
[
"DNS"
]
=
dns
bot
=
create_bot
(
cfgfile
=
configuration
,
mapping
=
mapping
)
return
bot
.
run
()
if
run
==
'status'
:
return
bot
.
status
()
elif
run
==
'crawl'
:
return
bot
.
run
()
else
:
raise
NotImplementedError
(
'Unexpected run: %s'
%
run
)
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment