Add --quiet
This commit is contained in:
parent
3e3c44075a
commit
d8c3cd2e36
16
netrun.py
16
netrun.py
|
@ -54,17 +54,25 @@ group.add_argument(
|
|||
action="store_true",
|
||||
help="Skip pager and confirmation; run script immediately",
|
||||
)
|
||||
group.add_argument(
|
||||
"-q",
|
||||
"--quiet",
|
||||
action="store_true",
|
||||
help="Skip pager and confirmation; run script immediately; do not print anything",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
url = args.url
|
||||
pager = shlex.split(args.pager)
|
||||
interpreter = shlex.split(args.interpreter)
|
||||
|
||||
print(f"Downloading `{url}`...")
|
||||
if not args.quiet:
|
||||
print(f"Downloading `{url}`...")
|
||||
content = requests.get(url).content
|
||||
print("Download successful.")
|
||||
print("=" * os.get_terminal_size().columns)
|
||||
if not args.quiet:
|
||||
print("Download successful.")
|
||||
print("=" * os.get_terminal_size().columns)
|
||||
|
||||
if args.skip_pager:
|
||||
if args.skip_pager or args.quiet:
|
||||
launch(interpreter, content)
|
||||
else:
|
||||
launch(pager, content)
|
||||
|
|
Loading…
Reference in New Issue
Block a user