Updated docs
This commit is contained in:
@@ -1 +1 @@
|
||||
# imports:
|
||||
# imports:
|
||||
|
@@ -6,27 +6,28 @@ from unittests_cli.constants import CLI_PATH
|
||||
|
||||
|
||||
class CLICommands:
|
||||
|
||||
@staticmethod
|
||||
def _run(cmd: str, *args, output=False):
|
||||
env_vars = os.environ
|
||||
env_vars['CPL_IS_UNITTEST'] = 'NO' if output else 'YES'
|
||||
env_vars["CPL_IS_UNITTEST"] = "NO" if output else "YES"
|
||||
|
||||
command = ['python', CLI_PATH, cmd]
|
||||
command = ["python", CLI_PATH, cmd]
|
||||
for arg in args:
|
||||
command.append(arg)
|
||||
|
||||
if output:
|
||||
subprocess.run(command, env=env_vars)
|
||||
else:
|
||||
subprocess.run(command, env=env_vars, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL)
|
||||
subprocess.run(
|
||||
command, env=env_vars, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.DEVNULL
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def _run_with_output(cmd: str, *args) -> str:
|
||||
env_vars = os.environ
|
||||
env_vars['CPL_IS_UNITTEST'] = 'NO'
|
||||
env_vars["CPL_IS_UNITTEST"] = "NO"
|
||||
|
||||
command = ['python', CLI_PATH, cmd]
|
||||
command = ["python", CLI_PATH, cmd]
|
||||
for arg in args:
|
||||
command.append(arg)
|
||||
|
||||
@@ -34,63 +35,63 @@ class CLICommands:
|
||||
|
||||
@classmethod
|
||||
def add(cls, source: str, target: str, output=False):
|
||||
cls._run('add', source, target, output=output)
|
||||
cls._run("add", source, target, output=output)
|
||||
|
||||
@classmethod
|
||||
def build(cls, output=False):
|
||||
cls._run('build', output=output)
|
||||
cls._run("build", output=output)
|
||||
|
||||
@classmethod
|
||||
def generate(cls, schematic: str, name: str, output=False):
|
||||
cls._run('generate', schematic, name, output=output)
|
||||
cls._run("generate", schematic, name, output=output)
|
||||
|
||||
@classmethod
|
||||
def install(cls, package: str = None, is_dev=False, output=False):
|
||||
if package is None:
|
||||
cls._run('install', output=output)
|
||||
cls._run("install", output=output)
|
||||
return
|
||||
|
||||
cls._run('install', package, '--dev' if is_dev else '', output=output)
|
||||
cls._run("install", package, "--dev" if is_dev else "", output=output)
|
||||
|
||||
@classmethod
|
||||
def new(cls, project_type: str, name: str, *args, output=False):
|
||||
cls._run('new', project_type, name, *args, output=output)
|
||||
cls._run("new", project_type, name, *args, output=output)
|
||||
|
||||
@classmethod
|
||||
def publish(cls, output=False):
|
||||
cls._run('publish', output=output)
|
||||
cls._run("publish", output=output)
|
||||
|
||||
@classmethod
|
||||
def remove(cls, project: str, output=False):
|
||||
cls._run('remove', project, output=output)
|
||||
cls._run("remove", project, output=output)
|
||||
|
||||
@classmethod
|
||||
def run(cls, project: str = None, is_dev=False, output=False):
|
||||
args = []
|
||||
if is_dev:
|
||||
args.append('--dev')
|
||||
args.append("--dev")
|
||||
|
||||
if project is None:
|
||||
cls._run('run', *args, output=output)
|
||||
cls._run("run", *args, output=output)
|
||||
return
|
||||
cls._run('run', project, *args, output=output)
|
||||
cls._run("run", project, *args, output=output)
|
||||
|
||||
@classmethod
|
||||
def start(cls, is_dev=False, output=False):
|
||||
args = []
|
||||
if is_dev:
|
||||
args.append('--dev')
|
||||
args.append("--dev")
|
||||
|
||||
cls._run('start', *args, output=output)
|
||||
cls._run("start", *args, output=output)
|
||||
|
||||
@classmethod
|
||||
def uninstall(cls, package: str, is_dev=False, output=False):
|
||||
cls._run('uninstall', package, '--dev' if is_dev else '', output=output)
|
||||
cls._run("uninstall", package, "--dev" if is_dev else "", output=output)
|
||||
|
||||
@classmethod
|
||||
def update(cls, output=False):
|
||||
cls._run('update', output=output)
|
||||
cls._run("update", output=output)
|
||||
|
||||
@classmethod
|
||||
def version(cls) -> str:
|
||||
return cls._run_with_output('version')
|
||||
return cls._run_with_output("version")
|
||||
|
@@ -2,8 +2,8 @@
|
||||
"ProjectSettings": {
|
||||
"Name": "unittest_shared",
|
||||
"Version": {
|
||||
"Major": "2022",
|
||||
"Minor": "12",
|
||||
"Major": "2023",
|
||||
"Minor": "2",
|
||||
"Micro": "0"
|
||||
},
|
||||
"Author": "",
|
||||
@@ -16,7 +16,7 @@
|
||||
"LicenseName": "",
|
||||
"LicenseDescription": "",
|
||||
"Dependencies": [
|
||||
"cpl-core>=2022.12.0"
|
||||
"cpl-core>=2023.2.0"
|
||||
],
|
||||
"PythonVersion": ">=3.10.4",
|
||||
"PythonPath": {},
|
||||
|
Reference in New Issue
Block a user