Skip to content

Commit

Permalink
V3.2.5
Browse files Browse the repository at this point in the history
   - 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 ...
  • Loading branch information
gfursin committed Oct 19, 2024
1 parent bc800cf commit ce4738a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 8 deletions.
4 changes: 3 additions & 1 deletion cm/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
## V3.2.4
## 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 ...

## V3.2.3
- added --new_branch to `cm pull repo` and `cm checkout repo`
Expand Down
2 changes: 1 addition & 1 deletion cm/cmind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Written by Grigori Fursin

__version__ = "3.2.4.1"
__version__ = "3.2.5"

from cmind.core import access
from cmind.core import x
Expand Down
26 changes: 20 additions & 6 deletions cm/cmind/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ def access(self, i, out = None):
if automation=='':
return {'return':4, 'error':'automation was not specified'}
else:
return {'return':4, 'error':'automation {} not found'.format(automation)}
return {'return':4, 'error':'automation "{}" not found'.format(automation)}

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

output_json = (control.get('j', False) or control.get('json', False))

self_time = control.get('time', False)
if not x_was_called and self_time:
import time
Expand Down Expand Up @@ -978,7 +980,7 @@ def x(self, i, out = None):
print ('')
print ('CMX elapsed time: {:.3f} sec.'.format(self_time))

if self.output == 'json':
if output_json:
utils.dump_safe_json(r)

# Restore directory of call
Expand Down Expand Up @@ -1014,9 +1016,10 @@ def _x(self, i, control):
if output == True:
output = 'con'

# Check and force json console output
if control.get('j', False) or control.get('json', False):
output = 'json'
# Changed in v3.2.5
# # Check and force json console output
# if control.get('j', False) or control.get('json', False):
# output = 'json'

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

# Can add popular shortcuts
elif action == 'ff':
task = ''
if automation != '' and (' ' in automation or ',' in automation):
task = automation
if ' ' in automation: task = automation.replace(' ',',')
i['task'] = task
automation = 'flex.flow'
action = 'run'
i['automation'] = automation
i['action'] = action

# Print basic help if action == ''
extra_help = True if action == 'help' and automation == '' else False
Expand Down Expand Up @@ -1291,7 +1305,7 @@ def _x(self, i, control):
if automation=='':
return {'return':4, 'error':'automation was not specified'}
else:
return {'return':4, 'error':f'automation {automation} not found'}
return {'return':4, 'error':f'automation "{automation}" not found'}

# If no automation was found or we force common automation
loaded_common_automation = False
Expand Down

0 comments on commit ce4738a

Please sign in to comment.