Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gajim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Weblate
gajim
Commits
09e1742b
Commit
09e1742b
authored
14 years ago
by
Alexander Cherniuk
Browse files
Options
Downloads
Patches
Plain Diff
Shortened a couple of things in the command system
parent
da1f16b0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/command_system/framework.py
+12
-12
12 additions, 12 deletions
src/command_system/framework.py
src/command_system/implementation/standard.py
+1
-1
1 addition, 1 deletion
src/command_system/implementation/standard.py
src/command_system/mapping.py
+1
-1
1 addition, 1 deletion
src/command_system/mapping.py
with
14 additions
and
14 deletions
src/command_system/framework.py
+
12
−
12
View file @
09e1742b
...
...
@@ -226,9 +226,9 @@ def command(*names, **properties):
can be reached. If no names are given - the the native name (the one
extracted from the command handler) will be used.
If
include_
native=True is given (default) and names is non-empty -
then the
native name of the command will be prepended in addition to
the
given names.
If native=True is given (default) and names is non-empty -
then the
native name of the command will be prepended in addition to
the
given names.
If usage=True is given (default) - then command help will be
appended with autogenerated usage info, based of the command handler
...
...
@@ -256,14 +256,14 @@ def command(*names, **properties):
If overlap=True is given - then all the extra arguments will be
mapped as if they were values for the keyword arguments.
If expand
_short
=True is given (default) - then short, one-letter
options
will be expanded to a verbose ones, based of the comparison
of the
first letter. If more then one option with the same first
letter is
given - then only first one will be used in the expansion.
If expand=True is given (default) - then short, one-letter
options
will be expanded to a verbose ones, based of the comparison
of the
first letter. If more then one option with the same first
letter is
given - then only first one will be used in the expansion.
"""
names
=
list
(
names
)
include_
native
=
properties
.
get
(
'
include_
native
'
,
True
)
native
=
properties
.
get
(
'
native
'
,
True
)
usage
=
properties
.
get
(
'
usage
'
,
True
)
source
=
properties
.
get
(
'
source
'
,
False
)
...
...
@@ -271,7 +271,7 @@ def command(*names, **properties):
empty
=
properties
.
get
(
'
empty
'
,
False
)
extra
=
properties
.
get
(
'
extra
'
,
False
)
overlap
=
properties
.
get
(
'
overlap
'
,
False
)
expand
_short
=
properties
.
get
(
'
expand
_short
'
,
True
)
expand
=
properties
.
get
(
'
expand
'
,
True
)
if
empty
and
not
raw
:
raise
DefinitionError
(
"
Empty option can be used only with raw commands
"
)
...
...
@@ -286,7 +286,7 @@ def command(*names, **properties):
'
extra
'
:
extra
,
'
overlap
'
:
overlap
,
'
empty
'
:
empty
,
'
expand
_short
'
:
expand
_short
'
expand
'
:
expand
}
def
decorator
(
handler
):
...
...
@@ -297,9 +297,9 @@ def command(*names, **properties):
command
=
Command
(
handler
,
*
names
,
**
properties
)
# Extract and inject a native name if either no other names are
# specified or
include_
native property is enabled, while making
# specified or native property is enabled, while making
# sure it is going to be the first one in the list.
if
not
names
or
include_
native
:
if
not
names
or
native
:
names
.
insert
(
0
,
command
.
native_name
)
command
.
names
=
tuple
(
names
)
...
...
This diff is collapsed.
Click to expand it.
src/command_system/implementation/standard.py
+
1
−
1
View file @
09e1742b
...
...
@@ -57,7 +57,7 @@ class StandardCommonCommands(CommandContainer):
self
.
chat_buttons_set_visible
(
new_status
)
@command
(
overlap
=
True
)
@doc
(
_
(
"
Show help on a given command or a list of available commands if -
(-a)ll
is given
"
))
@doc
(
_
(
"
Show help on a given command or a list of available commands if -
a
is given
"
))
def
help
(
self
,
command
=
None
,
all
=
False
):
if
command
:
command
=
self
.
get_command
(
command
)
...
...
This diff is collapsed.
Click to expand it.
src/command_system/mapping.py
+
1
−
1
View file @
09e1742b
...
...
@@ -205,7 +205,7 @@ def adapt_arguments(command, arguments, args, opts):
# The second stage of transforming options to an associatable state.
# Expanding short, one-letter options to a verbose ones, if
# corresponding optin has been given.
if
command
.
expand
_short
:
if
command
.
expand
:
expanded
=
[]
for
spec_key
,
spec_value
in
norm_kwargs
.
iteritems
():
letter
=
spec_key
[
0
]
if
len
(
spec_key
)
>
1
else
None
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment