Skip to content

Commit ce4738a

Browse files
author
Grigori Fursin
committed
V3.2.5
- CMX: improved logging - CMX: improved error handling (show module path and line number) - CMX: fixed bug when detecting unknown control flag - CMX: do not change output to json if -j or --json just print json in the end ...
1 parent bc800cf commit ce4738a

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

cm/CHANGES.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
## V3.2.4
1+
## V3.2.5
22
- CMX: improved logging
33
- CMX: improved error handling (show module path and line number)
44
- CMX: fixed bug when detecting unknown control flag
5+
- CMX: do not change output to json if -j or --json
6+
just print json in the end ...
57

68
## V3.2.3
79
- added --new_branch to `cm pull repo` and `cm checkout repo`

cm/cmind/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#
33
# Written by Grigori Fursin
44

5-
__version__ = "3.2.4.1"
5+
__version__ = "3.2.5"
66

77
from cmind.core import access
88
from cmind.core import x

cm/cmind/core.py

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -616,7 +616,7 @@ def access(self, i, out = None):
616616
if automation=='':
617617
return {'return':4, 'error':'automation was not specified'}
618618
else:
619-
return {'return':4, 'error':'automation {} not found'.format(automation)}
619+
return {'return':4, 'error':'automation "{}" not found'.format(automation)}
620620

621621
# If no automation was found or we force common automation
622622
if use_common_automation or len(automation_lst)==0:
@@ -857,6 +857,8 @@ def x(self, i, out = None):
857857
if control.pop('f', ''):
858858
i['f'] = True
859859

860+
output_json = (control.get('j', False) or control.get('json', False))
861+
860862
self_time = control.get('time', False)
861863
if not x_was_called and self_time:
862864
import time
@@ -978,7 +980,7 @@ def x(self, i, out = None):
978980
print ('')
979981
print ('CMX elapsed time: {:.3f} sec.'.format(self_time))
980982

981-
if self.output == 'json':
983+
if output_json:
982984
utils.dump_safe_json(r)
983985

984986
# Restore directory of call
@@ -1014,9 +1016,10 @@ def _x(self, i, control):
10141016
if output == True:
10151017
output = 'con'
10161018

1017-
# Check and force json console output
1018-
if control.get('j', False) or control.get('json', False):
1019-
output = 'json'
1019+
# Changed in v3.2.5
1020+
# # Check and force json console output
1021+
# if control.get('j', False) or control.get('json', False):
1022+
# output = 'json'
10201023

10211024
# Set self.output to the output of the very first access
10221025
# to print error in the end if needed
@@ -1050,6 +1053,17 @@ def _x(self, i, control):
10501053
elif action == 'init' and automation == '':
10511054
automation = 'core'
10521055

1056+
# Can add popular shortcuts
1057+
elif action == 'ff':
1058+
task = ''
1059+
if automation != '' and (' ' in automation or ',' in automation):
1060+
task = automation
1061+
if ' ' in automation: task = automation.replace(' ',',')
1062+
i['task'] = task
1063+
automation = 'flex.flow'
1064+
action = 'run'
1065+
i['automation'] = automation
1066+
i['action'] = action
10531067

10541068
# Print basic help if action == ''
10551069
extra_help = True if action == 'help' and automation == '' else False
@@ -1291,7 +1305,7 @@ def _x(self, i, control):
12911305
if automation=='':
12921306
return {'return':4, 'error':'automation was not specified'}
12931307
else:
1294-
return {'return':4, 'error':f'automation {automation} not found'}
1308+
return {'return':4, 'error':f'automation "{automation}" not found'}
12951309

12961310
# If no automation was found or we force common automation
12971311
loaded_common_automation = False

0 commit comments

Comments
 (0)