Skip to content

Commit

Permalink
script can be used on Posix only
Browse files Browse the repository at this point in the history
  • Loading branch information
MAGANER committed Mar 27, 2024
1 parent 33c4d0a commit 93ccc09
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 19 deletions.
6 changes: 6 additions & 0 deletions __main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,14 @@
import sys
import requests
import json
import os

if __name__ == "__main__":
#read getch.py to see the reason
if os.name != "posix":
print("Sorry! This script won't run on non-posix system!")
system.exit(1)

args = aurwatcher.parse_arguments()

response = requests.get(aurwatcher.compute_request(args))
Expand Down
19 changes: 0 additions & 19 deletions aurwatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,6 @@
import subprocess
from getch import read_single_char

def print_help():
options = '''
arch-watcher looks for packages in AUR or in official repository.\n\n
./arch-watcher p=emacs s=[aur|off] o=[pt|ip]\n
p - package name \n
s - source(aur xor official repo) \n
o - output mode(plain text xor inner pager) plain text is choosen by default\n
'''
print(options)

def process_mode(mode_value):
if mode_value not in ("pt","ip"):
print("incorrect value for ouput mode {}".format(mode_value))
print_help()
sys.exit(1)

return False if mode_value == "pt" else True

def prepare_arguments():
parser = argparse.ArgumentParser(prog="aurwatcher",description="script looks for packages in AUR or in official repository.")
parser.add_argument("p",help="defines package-name substring to look for")
Expand Down
2 changes: 2 additions & 0 deletions getch.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import sys, tty, termios


def read_single_char():
fd = sys.stdin.fileno()
old_settings = termios.tcgetattr(fd)
Expand Down

0 comments on commit 93ccc09

Please sign in to comment.