mirror of
https://github.com/google/bumble.git
synced 2026-05-31 07:27:01 +00:00
Merge pull request #41 from google/gbg/cli-scripts
use arg-less main() functions in all scripts
This commit is contained in:
+2
-2
@@ -90,7 +90,7 @@ class SnoopPacketReader:
|
||||
@click.command()
|
||||
@click.option('--format', type=click.Choice(['h4', 'snoop']), default='h4', help='Format of the input file')
|
||||
@click.argument('filename')
|
||||
def show(format, filename):
|
||||
def main(format, filename):
|
||||
input = open(filename, 'rb')
|
||||
if format == 'h4':
|
||||
packet_reader = PacketReader(input)
|
||||
@@ -117,4 +117,4 @@ def show(format, filename):
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
show()
|
||||
main()
|
||||
|
||||
+4
-6
@@ -29,6 +29,7 @@
|
||||
import os
|
||||
import logging
|
||||
import sys
|
||||
import click
|
||||
import usb1
|
||||
from colors import color
|
||||
|
||||
@@ -149,6 +150,8 @@ def is_bluetooth_hci(device):
|
||||
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
@click.command()
|
||||
@click.option('--verbose', is_flag=True, default=False, help='Print more details')
|
||||
def main(verbose):
|
||||
logging.basicConfig(level = os.environ.get('BUMBLE_LOGLEVEL', 'WARNING').upper())
|
||||
|
||||
@@ -233,9 +236,4 @@ def main(verbose):
|
||||
|
||||
# -----------------------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) == 2 and sys.argv[1] == '--verbose':
|
||||
verbose = True
|
||||
else:
|
||||
verbose = False
|
||||
|
||||
main(verbose)
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user