mirror of
https://github.com/Websoft9/websoft9.git
synced 2024-11-21 23:20:23 +00:00
mvc
This commit is contained in:
parent
d136aa4805
commit
2c04627f8d
9 changed files with 56 additions and 9 deletions
14
cli/Notes.md
Normal file
14
cli/Notes.md
Normal file
|
@ -0,0 +1,14 @@
|
|||
## CLI 开发备注
|
||||
|
||||
整个CLI采用MVC思想:
|
||||
|
||||
* stackhub.py 代表视图层 V,用户体验层,专注体验编排,不进行条件编程
|
||||
* model.py 代表数据层 M。这是系统的最底层,都是与业务无关的系统级功能
|
||||
* controller.py 代表控制层 C。调用 M 层,针对业务编程
|
||||
|
||||
#### 用户如何获取项目清单?
|
||||
|
||||
用户同步 stackhub 上已经存放的清单,而不是通过 API 获取。原因:
|
||||
|
||||
1. 避免API使用需要授权或超时
|
||||
2. 避免未发布的应用被安装
|
BIN
cli/__pycache__/controller.cpython-36.pyc
Normal file
BIN
cli/__pycache__/controller.cpython-36.pyc
Normal file
Binary file not shown.
BIN
cli/__pycache__/core.cpython-36.pyc
Normal file
BIN
cli/__pycache__/core.cpython-36.pyc
Normal file
Binary file not shown.
BIN
cli/__pycache__/model.cpython-36.pyc
Normal file
BIN
cli/__pycache__/model.cpython-36.pyc
Normal file
Binary file not shown.
12
cli/controller.py
Normal file
12
cli/controller.py
Normal 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
1
cli/install.sh
Normal file
|
@ -0,0 +1 @@
|
|||
yum install git pwgen jq wget curl figlet boxes -y
|
|
@ -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())
|
|
@ -1,3 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
python3 stackhub.py
|
|
@ -1,39 +1,49 @@
|
|||
#!/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):
|
||||
'''install one application'''
|
||||
|
|
Loading…
Reference in a new issue