websoft9/cli/stackhub.py

83 lines
2 KiB
Python
Raw Permalink Normal View History

2021-09-26 07:22:38 +00:00
#!/usr/bin/env python3
2021-09-27 09:32:10 +00:00
from typing import Any, Callable, Dict, List, Optional, Sequence, Tuple, Type, Union
2021-09-23 10:06:29 +00:00
import os, io, sys, platform, shutil, urllib3, json, time, subprocess
2021-09-26 09:57:34 +00:00
import model, controller
2021-09-23 10:06:29 +00:00
import typer
app = typer.Typer()
@app.command()
2021-10-18 11:07:41 +00:00
def ls(status: Optional[str] = 'all'):
'''list all the project have installed'''
2021-10-31 10:00:02 +00:00
myprint = controller.Print(status)
myprint.lsProject()
2021-09-26 15:05:59 +00:00
@app.command()
2021-09-27 09:32:10 +00:00
def create(app_name: str, project_name: Optional[str] = None):
'''create one application'''
create = controller.Create(app_name, project_name)
create.downRepo()
2021-09-28 10:34:18 +00:00
create.setEnv()
2021-10-10 15:54:15 +00:00
create.upRepo()
2021-09-28 10:34:18 +00:00
create.printResult()
2021-11-01 11:23:17 +00:00
@app.command()
def up(path: str):
'''up one deleted application'''
2021-11-02 12:54:10 +00:00
status = controller.Status(None, path)
status.upApp()
2021-09-28 10:34:18 +00:00
@app.command()
2021-11-01 11:23:17 +00:00
def start(project_name: str):
'''start one stopped application'''
status = controller.Status(project_name)
status.startApp()
2021-09-26 07:22:38 +00:00
@app.command()
2021-11-01 11:23:17 +00:00
def stop(project_name: str):
'''start one running application'''
status = controller.Status(project_name)
status.stopApp()
@app.command()
def restart(project_name: str):
'''Restart one application'''
status = controller.Status(project_name)
status.retartApp()
@app.command()
2021-11-02 12:54:10 +00:00
def delete(project_name: str):
2021-11-01 11:23:17 +00:00
'''erase or delete an application'''
status = controller.Status(project_name)
2021-11-02 12:54:10 +00:00
status.deleteApp()
2021-11-01 11:23:17 +00:00
@app.command()
def update(project_name: str):
2021-09-26 07:22:38 +00:00
'''update the local lists cache'''
2021-11-01 11:23:17 +00:00
typer.echo(f"Hello {project_name}")
2021-09-26 09:57:34 +00:00
2021-09-26 07:22:38 +00:00
@app.command()
def upgrade(name: str):
'''upgrade one application'''
typer.echo(f"Hello {name}")
2021-09-26 09:57:34 +00:00
2021-09-26 07:22:38 +00:00
@app.command()
def search(name: str):
'''Search application you want to install'''
2021-09-23 10:06:29 +00:00
typer.echo(f"Hello {name}")
2021-09-26 07:22:38 +00:00
@app.command()
def show(name: str):
'''show the detail of application'''
typer.echo(f"Hello {name}")
2021-10-31 10:00:02 +00:00
2021-09-26 09:57:34 +00:00
@app.command()
def package(name: str):
'''package one application for no network environment'''
typer.echo(f"Hello {name}")
2021-09-23 10:06:29 +00:00
if __name__ == "__main__":
2021-09-26 07:22:38 +00:00
app()