Compare commits

...

2 commits

Author SHA1 Message Date
minecraftchest1@outlook.com
5bd592dc1c Add gitignore 2025-04-03 10:15:46 -05:00
minecraftchest1@outlook.com
ee442e01b2 Add argparse 2025-04-01 10:15:07 -05:00
2 changed files with 16 additions and 2 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
.venv/

17
main.py
View file

@ -1,6 +1,9 @@
import argparse
import sys
import bluetooth
import bluetooth #PyBluez
version = '0.0.0'
def bluetooth_scan():
print('Discovering Bluetooth Devices...')
@ -12,7 +15,17 @@ def bluetooth_scan():
print(f'{device[0]}\t{device[1]}')
def main():
bluetooth_scan()
argparser = argparse.ArgumentParser(description='CarPI CLI.')
# Create actions
actions = argparser.add_subparsers(title='actions', required=True)
action_list = actions.add_parser('list', help='list nearby bluetooth devices')
action_list.set_defaults(func=bluetooth_scan)
action_connect = actions.add_parser('connect', help='connect to a bluetooth device')
args = argparser.parse_args()
print(args)
args.func()
if (__name__ == "__main__"):
sys.exit(main())