Michael Pasternak has uploaded a new change for review.

Change subject: cli: Need to rename /delete command with /remove #855769
......................................................................

cli: Need to rename /delete command with /remove #855769

https://bugzilla.redhat.com/show_bug.cgi?id=855769

Change-Id: Ia59d096ab02e3c061903a9d96f18650ce39654e3
Signed-off-by: Michael Pasternak <mpast...@redhat.com>
---
M src/ovirtcli/command/__init__.py
R src/ovirtcli/command/remove.py
M src/ovirtcli/context.py
M src/ovirtcli/shell/engineshell.py
R src/ovirtcli/shell/removecmdshell.py
5 files changed, 37 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine-cli refs/changes/98/7898/1

diff --git a/src/ovirtcli/command/__init__.py b/src/ovirtcli/command/__init__.py
index 6971a8f..3a221d4 100644
--- a/src/ovirtcli/command/__init__.py
+++ b/src/ovirtcli/command/__init__.py
@@ -3,7 +3,7 @@
 from ovirtcli.command.add import AddCommand
 from ovirtcli.command.connect import ConnectCommand
 from ovirtcli.command.console import ConsoleCommand
-from ovirtcli.command.delete import DeleteCommand
+from ovirtcli.command.remove import RemoveCommand
 from ovirtcli.command.disconnect import DisconnectCommand
 from ovirtcli.command.getkey import GetKeyCommand
 from ovirtcli.command.help import HelpCommand
diff --git a/src/ovirtcli/command/delete.py b/src/ovirtcli/command/remove.py
similarity index 80%
rename from src/ovirtcli/command/delete.py
rename to src/ovirtcli/command/remove.py
index e3c41f4..a1159f3 100644
--- a/src/ovirtcli/command/delete.py
+++ b/src/ovirtcli/command/remove.py
@@ -20,24 +20,24 @@
 from cli.messages import Messages
 
 
-class DeleteCommand(OvirtCommand):
+class RemoveCommand(OvirtCommand):
 
     name = 'delete'
     aliases = ('remove',)
-    description = 'delete an object'
+    description = 'removes an object'
     args_check = 2
     valid_options = [ ('*', str) ]
 
     helptext = """\
         == Usage ==
     
-        delete <type> <id> [object identifiers] [attribute options]
+        remove <type> <id> [object identifiers] [attribute options]
 
         == Description ==
 
-        Delete an object. The following arguments are required:
+        Removes an object. The following arguments are required:
 
-          * type        The type of object to delete
+          * type        The type of object to remove
           * id          The object identifier
 
         Objects can be identified by their name and by their unique id.
@@ -46,13 +46,13 @@
 
         - This help will list all available attribute options for given 
resource removal
           
-          * format      - help delete type
-          * example     - help delete storagedomain mydomain
+          * format      - help remove type
+          * example     - help remove storagedomain mydomain
 
         - This help will list all available attribute options for given 
subresource removal
           
-          * format      - help delete subtype --resource-identifier
-          * example     - help delete disk --vm-identifier iscsi_desktop
+          * format      - help remove subtype --resource-identifier
+          * example     - help remove disk --vm-identifier iscsi_desktop
 
         == Available Types ==
 
@@ -73,17 +73,17 @@
 
         == Examples ==
 
-        - This example deletes a virtual machine named "myvm"
+        - This example removes a virtual machine named "myvm"
 
-          $ delete vm myvm
+          $ remove vm myvm
 
-        - This example deletes the disk "disk0" from the virtual machine named 
"myvm"
+        - This example removes the disk "disk0" from the virtual machine named 
"myvm"
 
-          $ delete disk disk0 --vm-identifier myvm
+          $ remove disk disk0 --vm-identifier myvm
           
-        - This example deletes the storagedomain "mydomain" using host named 
"myhost"
+        - This example removes the storagedomain "mydomain" using host named 
"myhost"
 
-          $ delete storagedomain mydomain --host-id myhost
+          $ remove storagedomain mydomain --host-id myhost
           
         == Return values ==
 
@@ -96,11 +96,11 @@
     helptext1 = """\
         == Usage ==
 
-        delete <type> <id> [object identifiers]
+        remove <type> <id> [object identifiers]
 
         == Description ==
 
-        Delete an object with type '$type'. See 'help delete' for generic
+        Removes an object with type '$type'. See 'help remove' for generic
         help on deleting objects.
 
         == Attribute Options ==
@@ -132,11 +132,11 @@
         """
 
     def execute(self):
-        """Execute "delete"."""
+        """Execute "remove"."""
         args = self.arguments
         opts = self.options
 
-        typs = TypeHelper.get_types_containing_method(DeleteCommand.name,
+        typs = TypeHelper.get_types_containing_method(RemoveCommand.name,
                                                       expendNestedTypes=True,
                                                       groupOptions=True)
 
@@ -146,21 +146,21 @@
                                    context_variants=typs[args[0]])
         if resource is None:
             self.error(Messages.Error.NO_SUCH_OBJECT % (args[0], args[1]))
-        elif hasattr(resource, DeleteCommand.name):
-            result = self.execute_method(resource, DeleteCommand.name, opts)
+        elif hasattr(resource, RemoveCommand.name):
+            result = self.execute_method(resource, RemoveCommand.name, opts)
         else:
             self.error(Messages.Error.OBJECT_IS_IMMUTABLE % (args[0], args[1]))
 
         self.context.formatter.format(self.context, result)
 
     def show_help(self):
-        """Show help for "delete"."""
+        """Show help for "remove"."""
         self.check_connection()
         args = self.arguments
         opts = self.options
 
         subst = {}
-        types = TypeHelper.get_types_containing_method(DeleteCommand.name,
+        types = TypeHelper.get_types_containing_method(RemoveCommand.name,
                                                        expendNestedTypes=True,
                                                        groupOptions=True)
 
@@ -176,7 +176,7 @@
                     self.error(Messages.Error.NO_SUCH_OBJECT % (args[0], 
args[1]))
 
                 helptext = self.helptext1
-                params_list = self.get_options(method=DeleteCommand.name,
+                params_list = self.get_options(method=RemoveCommand.name,
                                                resource=obj,
                                                sub_resource=base,
                                                context_variants=types[args[0]])
@@ -187,7 +187,7 @@
                 helptext = self.helptext1
                 subst['type'] = args[0]
 
-                options = self.get_options(method=DeleteCommand.name,
+                options = self.get_options(method=RemoveCommand.name,
                                            resource=args[0],
                                            
sub_resource=self.resolve_base(self.options),
                                            context_variants=types[args[0]])
diff --git a/src/ovirtcli/context.py b/src/ovirtcli/context.py
index b594c1d..05b6166 100644
--- a/src/ovirtcli/context.py
+++ b/src/ovirtcli/context.py
@@ -91,7 +91,7 @@
         self.add_command(AddCommand)
         self.add_command(ConnectCommand)
         self.add_command(ConsoleCommand)
-        self.add_command(DeleteCommand)
+        self.add_command(RemoveCommand)
         self.add_command(DisconnectCommand)
 #        self.add_command(GetKeyCommand)
         self.add_command(HelpCommand)
diff --git a/src/ovirtcli/shell/engineshell.py 
b/src/ovirtcli/shell/engineshell.py
index f6aa272..4a1ef4b 100644
--- a/src/ovirtcli/shell/engineshell.py
+++ b/src/ovirtcli/shell/engineshell.py
@@ -26,7 +26,7 @@
 from ovirtcli.shell.showcmdshell import ShowCmdShell
 from ovirtcli.shell.listcmdshell import ListCmdShell
 from ovirtcli.shell.updatecmdshell import UpdateCmdShell
-from ovirtcli.shell.deletecmdshell import DeleteCmdShell
+from ovirtcli.shell.removecmdshell import RemoveCmdShell
 from ovirtcli.shell.addcmdshell import AddCmdShell
 from ovirtcli.shell.disconnectcmdshell import DisconnectCmdShell
 from ovirtcli.shell.consolecmdshell import ConsoleCmdShell
@@ -45,7 +45,7 @@
 
 class EngineShell(cmd.Cmd, ConnectCmdShell, ActionCmdShell, \
                   ShowCmdShell, ListCmdShell, UpdateCmdShell, \
-                  DeleteCmdShell, AddCmdShell, DisconnectCmdShell, \
+                  RemoveCmdShell, AddCmdShell, DisconnectCmdShell, \
                   ConsoleCmdShell, PingCmdShell, StatusCmdShell, \
                   ClearCmdShell, FileCmdShell, HistoryCmdShell, \
                   InfoCmdShell):
@@ -58,7 +58,7 @@
         ShowCmdShell.__init__(self, context, parser)
         ListCmdShell.__init__(self, context, parser)
         UpdateCmdShell.__init__(self, context, parser)
-        DeleteCmdShell.__init__(self, context, parser)
+        RemoveCmdShell.__init__(self, context, parser)
         AddCmdShell.__init__(self, context, parser)
         DisconnectCmdShell.__init__(self, context, parser)
         ConsoleCmdShell.__init__(self, context, parser)
diff --git a/src/ovirtcli/shell/deletecmdshell.py 
b/src/ovirtcli/shell/removecmdshell.py
similarity index 84%
rename from src/ovirtcli/shell/deletecmdshell.py
rename to src/ovirtcli/shell/removecmdshell.py
index fff0e67..26489a8 100644
--- a/src/ovirtcli/shell/deletecmdshell.py
+++ b/src/ovirtcli/shell/removecmdshell.py
@@ -22,29 +22,29 @@
 from ovirtcli.utils.methodhelper import MethodHelper
 
 
-class DeleteCmdShell(CmdShell):
+class RemoveCmdShell(CmdShell):
     NAME = 'delete'
 
     def __init__(self, context, parser):
         CmdShell.__init__(self, context, parser)
 
-    def do_delete(self, args):
-        return self.context.execute_string(DeleteCmdShell.NAME + ' ' + args + 
'\n')
+    def do_remove(self, args):
+        return self.context.execute_string(RemoveCmdShell.NAME + ' ' + args + 
'\n')
 
     def __add_resource_specific_options(self, obj, specific_options, line, 
key=None):
         obj_type = TypeHelper.getDecoratorType(TypeHelper.to_singular(obj))
         if obj_type and hasattr(brokers, obj_type):
             obj_typ_ref = getattr(brokers, obj_type)
-            if obj_typ_ref and hasattr(obj_typ_ref, DeleteCmdShell.NAME):
-                method_args = 
MethodHelper.get_documented_arguments(method_ref=getattr(obj_typ_ref, 
DeleteCmdShell.NAME),
+            if obj_typ_ref and hasattr(obj_typ_ref, RemoveCmdShell.NAME):
+                method_args = 
MethodHelper.get_documented_arguments(method_ref=getattr(obj_typ_ref, 
RemoveCmdShell.NAME),
                                                                     
as_params_collection=True,
                                                                     
spilt_or=True)
 
                 if method_args:
                     specific_options[key if key is not None else obj] = 
method_args
 
-    def complete_delete(self, text, line, begidx, endidx):
-        args = TypeHelper.get_types_containing_method(DeleteCmdShell.NAME, 
expendNestedTypes=True)
+    def complete_remove(self, text, line, begidx, endidx):
+        args = TypeHelper.get_types_containing_method(RemoveCmdShell.NAME, 
expendNestedTypes=True)
         specific_options = self.get_resource_specific_options(args,
                                                               line,
                                                               
callback=self.__add_resource_specific_options)


--
To view, visit http://gerrit.ovirt.org/7898
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia59d096ab02e3c061903a9d96f18650ce39654e3
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine-cli
Gerrit-Branch: master
Gerrit-Owner: Michael Pasternak <mpast...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to