Ejemplo n.º 1
0
def alterrank(arglist):
	if len(arglist) < 4:
		print 'change rank'
		print 'Usage: python cell.py rr oldrank newrank'
		print 'example: python cell.py rr 10 10.1'
		return
	entmgr(cm.entrydb).alterrank(arglist)
Ejemplo n.º 2
0
def altercontent(arglist):
	if len(arglist) < 4:
		print 'alter entry content by text reference number'
		print 'Usage: python cell.py ac rank target operation'
		print 'example'
		print 'python cell.py ac 10 3{+"insert newline",="replace line",-}'
		print '$ rc ac - ="kck"'
		return
	entmgr(cm.entrydb).altercontent(arglist)
Ejemplo n.º 3
0
def rm(arglist):
	"""
	rm entry(ies)
	"""
	if len(arglist) < 3:
		print 'rm entry(ies)'
		print 'Usage: python cell.py rm rank "query string" ...'
		print 'example: rc rm . tag=alter # remove all the entries tag contains alter'
		return
	entmgr(cm.entrydb).rm(arglist)
Ejemplo n.º 4
0
def alter(arglist):
	if len(arglist) < 4:
		print 'alter entry'
		print 'Usage: python cell.py alter rank {"query string" ...} "update value" ...'
		print 'example:'
		print 'python cell.py alter . stage:data'
		print 'python cell.py alter 2:5 stage=dvlp stage:dvlp-1'
		print 'python cell.py alter 2: tag=test stage=dvlp project:dvlp-1'
		return
	entmgr(cm.entrydb).alter(arglist)
Ejemplo n.º 5
0
def add(arglist):
	"""
	Add an entry

	"""
	if len(arglist) < 4:
		print 'add en entry:'
		print 'Usage: python cell.py add ent.name content {tag=t1,t2,t3} {ext1=e1 ext2=e2}'
		print 'example: python cell.py add .pdb "protein structure file" tag=file,raw stage="data-collection" time="201705160615"'
		return
	entmgr(cm.entrydb).add(arglist)
	print 'entry added in %s' % cm.entrydb
Ejemplo n.º 6
0
def info(arglist):
	if len(arglist) < 3:
		print 'show entry info'
		print 'Usage: python cell.py info rank "query string" ...'
		print 'example:\npython cell.py info .'
		print 'python cell.py info . stage=dvlp'
		print 'python cell.py info 5:'
		print 'python cell.py info :5 tag=test,debug stage=dvlp'
		print 'python cell.py info 2:5 tag=debug stage=test'
		print 'python cell.py info -'
		return

	em = entmgr(cm.entrydb)
	sortlist = em.info(arglist)
	cm.fmtout(sortlist)

	print 'list %d records.' % len(sortlist)
Ejemplo n.º 7
0
Archivo: main.py Proyecto: jkjium/kcell
def init(arglist):
    if len(arglist) < 3:
        print 'Initializ cell meta db.'
        print 'Usage: cell init cellname description\n'
        return

    if not os.path.exists(cm.entrydb):
        cellname = arglist[2]
        description = arglist[3]

        addcmd = ['', '', cellname, description, 'tag=init']
        db = TinyDB(cm.entrydb)  # create file
        em = entmgr(cm.entrydb)
        em.add(addcmd)
        print 'cell [%s] init done.' % cellname
    else:
        print 'cannot create cell meta: File (%s) exists' % cm.entrydb
    '''