forked from smidgedy/stikki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
34 lines (25 loc) · 739 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import requests
import argparse
import os
import shutil
width = shutil.get_terminal_size().columns
ip = "localhost"
port = 5000
def list(server_ip, port):
response = requests.get(f"http://127.0.0.1:5000/list").json()
for i in response:
print("-" * width)
print(f"\nTitle: '{i['title']}'")
print(f"\n> {i['content']}\n")
print("-" * width)
# create a new ArgumentParser object
parser = argparse.ArgumentParser()
# add a new standalone switch
parser.add_argument("-l", "--list", action="store_true", help="list notes")
# parse the command line arguments
args = parser.parse_args()
# check if the verbose switch is set
if args.list:
list(ip, port)
else:
print("Verbose mode disabled")