Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Adding an option to display the version and quit #3043

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cuckoo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def handle_sigterm(sig, f):
stop()

@click.group(invoke_without_command=True)
@click.option("-V", "--version", is_flag=True, help="Display the version of Cuckoo")
@click.option("-d", "--debug", is_flag=True, help="Enable verbose logging")
@click.option("-q", "--quiet", is_flag=True, help="Only log warnings and critical messages")
@click.option("--nolog", is_flag=True, help="Don't log to file.")
Expand All @@ -256,7 +257,7 @@ def handle_sigterm(sig, f):
@click.option("--user", help="Drop privileges to this user")
@click.option("--cwd", help="Cuckoo Working Directory")
@click.pass_context
def main(ctx, debug, quiet, nolog, maxcount, ignore_vuln, user, cwd):
def main(ctx, version, debug, quiet, nolog, maxcount, ignore_vuln, user, cwd):
"""Invoke the Cuckoo daemon or one of its subcommands.

To be able to use different Cuckoo configurations on the same machine with
Expand All @@ -271,6 +272,10 @@ def main(ctx, debug, quiet, nolog, maxcount, ignore_vuln, user, cwd):
* Current directory (if the ".cwd" file exists)
* Default value ("~/.cuckoo")
"""
if version:
print(cuckoo.misc.version)
return

decide_cwd(cwd)

# Drop privileges.
Expand Down