mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-21 23:20:23 +00:00
cli
This commit is contained in:
parent
fb585443c4
commit
0866969ddc
4 changed files with 38 additions and 0 deletions
|
@ -0,0 +1,3 @@
|
||||||
|
## CLI
|
||||||
|
|
||||||
|
This CLI solution is based on [tpyer](https://typer.tiangolo.com/)
|
10
cli/install.sh
Normal file
10
cli/install.sh
Normal 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
1
cli/requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
typer
|
24
cli/stackhub.py
Normal file
24
cli/stackhub.py
Normal 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()
|
Loading…
Reference in a new issue