Added logic to change base path for cpl n #120
This commit is contained in:
@@ -54,6 +54,7 @@ class NewService(CommandABC):
|
||||
self._use_service_providing: bool = False
|
||||
self._use_async: bool = False
|
||||
self._use_venv: bool = False
|
||||
self._use_base: bool = False
|
||||
|
||||
@property
|
||||
def help_message(self) -> str:
|
||||
@@ -159,7 +160,8 @@ class NewService(CommandABC):
|
||||
if self._workspace is None:
|
||||
project_path = os.path.join(self._env.working_directory, self._rel_path, self._project.name)
|
||||
else:
|
||||
project_path = os.path.join(self._env.working_directory, 'src', self._rel_path, String.convert_to_snake_case(self._project.name))
|
||||
base = '' if self._use_base else 'src'
|
||||
project_path = os.path.join(self._env.working_directory, base, self._rel_path, String.convert_to_snake_case(self._project.name))
|
||||
|
||||
if os.path.isdir(project_path) and len(os.listdir(project_path)) > 0:
|
||||
Console.write_line(project_path)
|
||||
@@ -292,6 +294,9 @@ class NewService(CommandABC):
|
||||
if self._env.working_directory.endswith(project):
|
||||
project = ''
|
||||
|
||||
if self._workspace is None and self._use_base:
|
||||
project = f'{self._rel_path}/{project}'
|
||||
|
||||
VenvHelper.init_venv(
|
||||
False,
|
||||
self._env,
|
||||
@@ -335,6 +340,9 @@ class NewService(CommandABC):
|
||||
if 'venv' in args:
|
||||
self._use_venv = True
|
||||
args.remove('venv')
|
||||
if 'base' in args:
|
||||
self._use_base = True
|
||||
args.remove('base')
|
||||
|
||||
console = self._config.get_configuration(ProjectTypeEnum.console.value)
|
||||
library = self._config.get_configuration(ProjectTypeEnum.library.value)
|
||||
|
@@ -55,7 +55,8 @@ class StartupArgumentExtension(StartupExtensionABC):
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'startup', ['s', 'S']) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'service-providing', ['sp', 'SP']) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'nothing', ['n', 'N']) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'venv', ['v', 'V'])
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'venv', ['v', 'V']) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'base', ['b', 'B'])
|
||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService, True, validators=[ProjectValidator])
|
||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService, True, validators=[WorkspaceValidator]) \
|
||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
|
||||
|
Reference in New Issue
Block a user