This commit is contained in:
chendelin1982 2021-09-26 17:57:34 +08:00
parent d136aa4805
commit 2c04627f8d
9 changed files with 56 additions and 9 deletions

14
cli/Notes.md Normal file
View file

@ -0,0 +1,14 @@
## CLI 开发备注
整个CLI采用MVC思想
* stackhub.py 代表视图层 V用户体验层专注体验编排不进行条件编程
* model.py 代表数据层 M。这是系统的最底层都是与业务无关的系统级功能
* controller.py 代表控制层 C。调用 M 层,针对业务编程
#### 用户如何获取项目清单?
用户同步 stackhub 上已经存放的清单,而不是通过 API 获取。原因:
1. 避免API使用需要授权或超时
2. 避免未发布的应用被安装

Binary file not shown.

Binary file not shown.

Binary file not shown.

12
cli/controller.py Normal file
View file

@ -0,0 +1,12 @@
import model
path_repo = "./data/application.list"
path_project = ""
class Print:
def __init__(self):
pass
def printRepo():
model.FileOp.printJson(path_repo)

1
cli/install.sh Normal file
View file

@ -0,0 +1 @@
yum install git pwgen jq wget curl figlet boxes -y

View file

@ -34,5 +34,18 @@ class Github:
def __init__(self):
pass
def
print(SmoothUrl.res(github_url))
def gitClone():
pass
class FileOp:
'''File operation'''
def __init__(self):
pass
def printJson(path: str):
with open(path,newline='') as file:
print(file.read())

View file

@ -1,3 +0,0 @@
#!/bin/sh
python3 stackhub.py

View file

@ -1,38 +1,48 @@
#!/usr/bin/env python3
import os, io, sys, platform, shutil, urllib3, json, time, subprocess
import model, controller
import typer
app = typer.Typer()
@app.command()
def list(name: str):
def list():
'''print the lists file'''
typer.echo(f"Hello {name}")
controller.Print.printRepo()
@app.command()
def update(name: str):
'''update the local lists cache'''
typer.echo(f"Hello {name}")
data
@app.command()
def upgrade(name: str):
'''upgrade one application'''
typer.echo(f"Hello {name}")
@app.command()
def search(name: str):
'''Search application you want to install'''
typer.echo(f"Hello {name}")
@app.command()
def show(name: str):
'''show the detail of application'''
typer.echo(f"Hello {name}")
@app.command()
def package(name: str):
'''package one application for no network environment'''
typer.echo(f"Hello {name}")
@app.command()
def install(name: str, formal: bool = False, type: str = None):