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",
|
action="store_true",
|
||||||
help="Skip pager and confirmation; run script immediately",
|
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()
|
args = parser.parse_args()
|
||||||
url = args.url
|
url = args.url
|
||||||
pager = shlex.split(args.pager)
|
pager = shlex.split(args.pager)
|
||||||
interpreter = shlex.split(args.interpreter)
|
interpreter = shlex.split(args.interpreter)
|
||||||
|
|
||||||
print(f"Downloading `{url}`...")
|
if not args.quiet:
|
||||||
|
print(f"Downloading `{url}`...")
|
||||||
content = requests.get(url).content
|
content = requests.get(url).content
|
||||||
print("Download successful.")
|
if not args.quiet:
|
||||||
print("=" * os.get_terminal_size().columns)
|
print("Download successful.")
|
||||||
|
print("=" * os.get_terminal_size().columns)
|
||||||
|
|
||||||
if args.skip_pager:
|
if args.skip_pager or args.quiet:
|
||||||
launch(interpreter, content)
|
launch(interpreter, content)
|
||||||
else:
|
else:
|
||||||
launch(pager, content)
|
launch(pager, content)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user