This commit is contained in:
chendelin1982 2021-09-23 18:06:29 +08:00
parent fb585443c4
commit 0866969ddc
4 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,3 @@
## CLI
This CLI solution is based on [tpyer](https://typer.tiangolo.com/)

10
cli/install.sh Normal file
View file

@ -0,0 +1,10 @@
pip3 install typer
# install Github CLI and upgrade it
sudo apt install dirmngr
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
sudo apt update
sudo apt install gh
sudo apt update
sudo apt install gh

1
cli/requirements.txt Normal file
View file

@ -0,0 +1 @@
typer

24
cli/stackhub.py Normal file
View file

@ -0,0 +1,24 @@
#!/usr/bin/python3
import os, io, sys, platform, shutil, urllib3, json, time, subprocess
import typer
app = typer.Typer()
@app.command()
def module(name: str):
typer.echo(f"Hello {name}")
@app.command()
def application(name: str, formal: bool = False):
if formal:
typer.echo(f"Goodbye Ms. {name}. Have a good day.")
else:
typer.echo(f"Bye {name}!")
if __name__ == "__main__":
app()