@@ -20,9 +20,10 @@ class Project:
20
20
if cmd .name == command_name :
21
21
return cmd
22
22
else :
23
- raise ValueError ("No command '" + command_name + "' found in config file " + __build_file_name__ () + "\n \n " +
24
- __help_message__ (self )
25
- )
23
+ raise ValueError (
24
+ "No command '" + command_name + "' found in config file " + __build_file_name__ () + "\n \n " +
25
+ __help_message__ (self )
26
+ )
26
27
27
28
def __has_command__ (self , command_name ):
28
29
for cmd in self .commands :
@@ -47,17 +48,12 @@ class Command:
47
48
48
49
49
50
def run (build_file_name , arguments ):
50
- """
51
- :param build_file_name: parametrize build file name & update the global BUILD_FILE_NAME variable with this value
52
- :param arguments: command line arguments will be passed here
53
- """
54
51
global BUILD_FILE_NAME
55
52
BUILD_FILE_NAME = build_file_name
56
-
57
53
try :
58
54
project = __parse_project_config__ ()
59
55
command_name = command_to_run (arguments )
60
- if command_name . lower () == "help" :
56
+ if command_name == "help" :
61
57
print (__help_message__ (project ))
62
58
else :
63
59
command = project .get_command (command_name )
@@ -68,10 +64,7 @@ def run(build_file_name, arguments):
68
64
69
65
def execute (command , before = None , after = None ):
70
66
cmd = command .cmd
71
-
72
- print (dash )
73
- print ("Name: " + command .name )
74
- print ("Command: " + command .cmd )
67
+ print (dash + "\n Name: " + command .name + "\n Command: " + command .cmd )
75
68
if before :
76
69
print ("Before: " + before )
77
70
cmd = before + " && " + cmd
@@ -119,10 +112,7 @@ def __build_file_name__(): return "'" + BUILD_FILE_NAME + "'"
119
112
120
113
121
114
def command_to_run (arguments ):
122
- if len (arguments ) is 1 :
123
- return "help"
124
- else :
125
- return arguments [1 ]
115
+ return "help" if len (arguments ) == 1 else arguments [1 ]
126
116
127
117
128
118
def sample_yaml_file ():
0 commit comments