diff options
| author | alex.boterolowry <alex.boterolowry@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2> | 2009-11-13 22:59:49 +0000 |
|---|---|---|
| committer | alex.boterolowry <alex.boterolowry@5914aa95-5b3a-0410-a3b5-7b719e7fe9b2> | 2009-11-13 22:59:49 +0000 |
| commit | c98d5cdaca13de6a9f6c991b33f1e7fba4708db5 (patch) | |
| tree | 2fd933a0f0674645f542c2372901b854b59c2aae /freebase/fcl | |
| parent | fb5eb2b76e75e334a91195241db4b0730be58066 (diff) | |
basic shell
git-svn-id: http://freebase-python.googlecode.com/svn/trunk@227 5914aa95-5b3a-0410-a3b5-7b719e7fe9b2
Diffstat (limited to 'freebase/fcl')
| -rwxr-xr-x | freebase/fcl/commands.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/freebase/fcl/commands.py b/freebase/fcl/commands.py index 804f3d9..c42d4cb 100755 --- a/freebase/fcl/commands.py +++ b/freebase/fcl/commands.py @@ -274,6 +274,36 @@ def cmd_cat(fb, id, include_headers=False): """ return cmd_get(fb, id, localfile='-', include_headers=include_headers) +def cmd_shell(fb): + import readline + def complete_cmd(text, state): + return '' + readline.set_completer(complete_cmd) +# readline.parse_and_bind('tab: complete') + graphs = {'http://trunk.qa.metaweb.com':'qa', + 'http://branch.qa.metaweb.com':'qa', + 'http://www.freebase.com':'otg', + 'http://api.freebase.com':'otg', + 'http://freebase.com':'otg', + 'http://www.sandbox-freebase.com':'sandbox', + 'http://api.sandbox-freebase.com':'sandbox', + 'http://sandbox-freebase.com':'sandbox' + } + + gname = graphs.get(fb.mss.service_url, 'unknown') + while True: + try: + line = raw_input((fb.mss.username+'@' if fb.mss.username else '') +gname+': '+fb.pwd+' > ') + except EOFError: + print + break + + if line: + args = line.split() + cmd = args.pop(0) + if cmd in fb.commands: + fb.dispatch(fb.commands[cmd], args, {}); + def cmd_get(fb, id, localfile=None, include_headers=False): """download a file from freebase %prog get id [localfile] |
