Commands: updated for JSON formatted comments with history
This commit is contained in:
@ -9,7 +9,8 @@ from obitools3.dms.view import RollbackException
|
||||
from obitools3.apps.config import logger
|
||||
|
||||
import time
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
__title__="Keep the N last lines of a view."
|
||||
|
||||
@ -39,6 +40,7 @@ def run(config):
|
||||
input = open_uri(config['obi']['inputURI'])
|
||||
if input is None:
|
||||
raise Exception("Could not read input view")
|
||||
i_dms = input[0]
|
||||
i_view = input[1]
|
||||
|
||||
# Read the name of the output view
|
||||
@ -60,7 +62,11 @@ def run(config):
|
||||
|
||||
for i in range(start, len(i_view)):
|
||||
selection.append(i)
|
||||
|
||||
|
||||
# Save command config in View comments
|
||||
command_line = " ".join(sys.argv[1:])
|
||||
comments = View.print_config(config, "tail", command_line, input_dms_name=[i_dms.name], input_view_name=[i_view.name])
|
||||
|
||||
# Create output view with the line selection
|
||||
try:
|
||||
o_view = selection.materialize(output_view_name, comments="obi tail: "+str(len(selection))+"\n")
|
||||
@ -69,6 +75,9 @@ def run(config):
|
||||
|
||||
# TODO DISCUSS if output URI to different DMS, copy view?
|
||||
|
||||
# Save command config in DMS comments
|
||||
i_dms.record_command_line(command_line)
|
||||
|
||||
print("\n")
|
||||
print(repr(o_view))
|
||||
|
||||
|
Reference in New Issue
Block a user