Skip to content

Instantly share code, notes, and snippets.

@dedSyn4ps3
Created February 10, 2024 01:31
Show Gist options
  • Save dedSyn4ps3/73ac7b4be8cdea0d207d18024bd31ea5 to your computer and use it in GitHub Desktop.
Save dedSyn4ps3/73ac7b4be8cdea0d207d18024bd31ea5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import argparse
from api import update
import rusty_python as rp
d = """
API test application using a combination
of pure Python functions and additional
helper modules written in Rust.
This application uses several Python libraries to
create a colorful commandline app with example
functionality implemented in Rust
"""
def cli():
parser = argparse.ArgumentParser(
description=d
)
parser.add_argument(
"-n", "--app-name",
action="store",
required=False,
help="App name to use for update download simulation"
)
parser.add_argument(
"-l", "--loop",
action="store_true",
required=False,
help="Run some test loops!. Uses `run_loops` implemented in Rust"
)
parser.add_argument(
"-r", "--rust-arg",
action="store",
required=False,
help="""
Tell us your name! This `string` value gets passed
to the `say_hello` function implemented in Rust. The function also runs
multiple `async` requests
"""
)
args = parser.parse_args()
if args:
if args.app_name:
update.checkVersion(args.app_name)
if args.loop:
rp.run_loops()
if args.rust_arg:
rp.say_hello(args.rust_arg)
rp.begin_request_test()
else:
parser.print_usage()
if __name__ == '__main__':
cli()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment