You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2012/11/08 08:06:18 UTC
git commit: cli: make commands pipe-able as on bash, on the shell
Updated Branches:
refs/heads/master fb57ceef5 -> c667eee57
cli: make commands pipe-able as on bash, on the shell
Makes commands pipe-able like bash.
Example while inside shell:
> list virtualmachines | grep id
> list accounts | more
Signed-off-by: Rohit Yadav <bh...@apache.org>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/c667eee5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/c667eee5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/c667eee5
Branch: refs/heads/master
Commit: c667eee570492fd2a382f5a69acdb4aa121fb7de
Parents: fb57cee
Author: Rohit Yadav <bh...@apache.org>
Authored: Thu Nov 8 12:26:54 2012 +0530
Committer: Rohit Yadav <bh...@apache.org>
Committed: Thu Nov 8 12:35:20 2012 +0530
----------------------------------------------------------------------
tools/cli/cloudmonkey/cloudmonkey.py | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/c667eee5/tools/cli/cloudmonkey/cloudmonkey.py
----------------------------------------------------------------------
diff --git a/tools/cli/cloudmonkey/cloudmonkey.py b/tools/cli/cloudmonkey/cloudmonkey.py
index 7a42b0b..83bd8c1 100644
--- a/tools/cli/cloudmonkey/cloudmonkey.py
+++ b/tools/cli/cloudmonkey/cloudmonkey.py
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/python
# -*- coding: utf-8 -*-
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
@@ -428,7 +428,13 @@ def main():
if '--help' in args:
self.print_shell(res[2])
return
- self.default(res[0] + " " + args_partition[2])
+ if '|' in args:
+ prog_name = sys.argv[0]
+ if '.py' in prog_name:
+ prog_name = "python " + prog_name
+ self.do_shell("%s %s %s" % (prog_name, rule, args))
+ else:
+ self.default(res[0] + " " + args_partition[2])
return grammar_closure
grammar_handler = add_grammar(rule)