Added logic to answer questions of new command dialog by flag arguments
This commit is contained in:
parent
15d938b172
commit
d23ea86ccf
@ -169,22 +169,22 @@ class NewService(CommandABC):
|
|||||||
Gets project information's from user
|
Gets project information's from user
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
if self._use_application_api or self._use_startup or self._use_service_providing or self._use_async:
|
||||||
|
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||||
|
Console.write_line('Skipping question due to given flags')
|
||||||
|
return
|
||||||
|
|
||||||
if not is_unittest:
|
if not is_unittest:
|
||||||
result = Console.read('Do you want to use application base? (y/n) ')
|
self._use_application_api = Console.read('Do you want to use application base? (y/n) ').lower() == 'y'
|
||||||
if result.lower() == 'y':
|
|
||||||
self._use_application_api = True
|
|
||||||
|
|
||||||
result = Console.read('Do you want to use startup? (y/n) ')
|
if not is_unittest and self._use_application_api:
|
||||||
if result.lower() == 'y':
|
self._use_startup = Console.read('Do you want to use startup? (y/n) ').lower() == 'y'
|
||||||
self._use_startup = True
|
|
||||||
else:
|
|
||||||
result = Console.read('Do you want to use service providing? (y/n) ')
|
|
||||||
if result.lower() == 'y':
|
|
||||||
self._use_service_providing = True
|
|
||||||
|
|
||||||
result = Console.read('Do you want to use async? (y/n) ')
|
if not is_unittest and not self._use_application_api:
|
||||||
if result.lower() == 'y':
|
self._use_service_providing = Console.read('Do you want to use service providing? (y/n) ').lower() == 'y'
|
||||||
self._use_async = True
|
|
||||||
|
if not self._use_async:
|
||||||
|
self._use_async = Console.read('Do you want to use async? (y/n) ').lower() == 'y'
|
||||||
|
|
||||||
Console.set_foreground_color(ForegroundColorEnum.default)
|
Console.set_foreground_color(ForegroundColorEnum.default)
|
||||||
|
|
||||||
@ -276,6 +276,22 @@ class NewService(CommandABC):
|
|||||||
:param args:
|
:param args:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
|
if 'async' in args:
|
||||||
|
self._use_async = True
|
||||||
|
args.remove('async')
|
||||||
|
|
||||||
|
if 'application-base' in args:
|
||||||
|
self._use_application_api = True
|
||||||
|
args.remove('application-base')
|
||||||
|
|
||||||
|
if 'startup' in args:
|
||||||
|
self._use_startup = True
|
||||||
|
args.remove('startup')
|
||||||
|
|
||||||
|
if 'service-providing' in args:
|
||||||
|
self._use_service_providing = True
|
||||||
|
args.remove('service-providing')
|
||||||
|
|
||||||
console = self._config.get_configuration(ProjectTypeEnum.console.value)
|
console = self._config.get_configuration(ProjectTypeEnum.console.value)
|
||||||
library = self._config.get_configuration(ProjectTypeEnum.library.value)
|
library = self._config.get_configuration(ProjectTypeEnum.library.value)
|
||||||
unittest = self._config.get_configuration(ProjectTypeEnum.unittest.value)
|
unittest = self._config.get_configuration(ProjectTypeEnum.unittest.value)
|
||||||
|
@ -86,7 +86,11 @@ class StartupArgumentExtension(StartupExtensionABC):
|
|||||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService, True) \
|
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'new', ['n', 'N'], NewService, True) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'console', ['c', 'C'], ' ') \
|
.add_console_argument(ArgumentTypeEnum.Variable, '', 'console', ['c', 'C'], ' ') \
|
||||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'library', ['l', 'L'], ' ') \
|
.add_console_argument(ArgumentTypeEnum.Variable, '', 'library', ['l', 'L'], ' ') \
|
||||||
.add_console_argument(ArgumentTypeEnum.Variable, '', 'unittest', ['ut', 'UT'], ' ')
|
.add_console_argument(ArgumentTypeEnum.Variable, '', 'unittest', ['ut', 'UT'], ' ') \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'async', ['a', 'A']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'application-base', ['ab', 'AB']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'startup', ['s', 'S']) \
|
||||||
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'service-providing', ['sp', 'SP'])
|
||||||
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'publish', ['p', 'P'], PublishService, True, validators=[ProjectValidator])
|
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]) \
|
config.create_console_argument(ArgumentTypeEnum.Executable, '', 'remove', ['r', 'R'], RemoveService, True, validators=[WorkspaceValidator]) \
|
||||||
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
|
.add_console_argument(ArgumentTypeEnum.Flag, '--', 'simulate', ['s', 'S'])
|
||||||
|
Loading…
Reference in New Issue
Block a user