Delete a shortcut

def action_rm(self):
        """
        Delete a shortcut
        """

        name = self.args['<name>']

        if self.args['all']:
            # delete all

            if ask_yes_no('Really delete ALL shortcuts?', default='no'):
                self.db_exec(''' DELETE FROM shortcuts ''')
                print_msg("All shortcuts deleted.")
            else:
                print_err("Aborted.")
                return

        else:
            # delete one

            # find by name
            self.db_exec('''
                SELECT id FROM shortcuts WHERE name=?
                ''', (name,))

            q = self.db_fetch_one()
            id = q[0]

            # delete if exists
            if q is None:
                print_err('Shortcut "%s" does not exist!' % name)

            else:
                self.db_exec('''
                    DELETE FROM shortcuts WHERE id=?
                    ''', (id,))

                # show OK message
                print_msg('Shortcut "%s" deleted.' % name)