Skip to content

Commit 93fd158

Browse files
committed
Align command switches between 'mbed ls' and 'mbed releases' (consistency)
1 parent 6ae5102 commit 93fd158

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

mbed/mbed.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2181,26 +2181,27 @@ def list_(detailed=False, prefix='', p_path=None, ignore=False):
21812181

21822182
# Command status for cross-SCM status of repositories
21832183
@subcommand('releases',
2184-
dict(name=['-a', '--all'], dest='all_refs', action='store_true', help='Show all releases, including release candidates, alphas, betas, etc'),
2184+
dict(name=['-a', '--all'], dest='detailed', action='store_true', help='Show revision hashes'),
2185+
dict(name=['-u', '--unstable'], dest='unstable', action='store_true', help='Show unstable releases well, e.g. release candidates, alphas, betas, etc'),
21852186
dict(name=['-r', '--recursive'], action='store_true', help='Show release tags for all libraries and sub-libraries as well'),
21862187
help='Show release tags',
21872188
description=(
21882189
"Show release tags for the current program or library."))
2189-
def releases_(all_refs=False, recursive=False, prefix='', p_path=None):
2190+
def releases_(detailed=False, unstable=False, recursive=False, prefix='', p_path=None):
21902191
repo = Repo.fromrepo()
21912192
tags = repo.scm.gettags()
21922193
revtags = repo.scm.gettags(repo.rev) if repo.rev else [] # associated tags with current commit
21932194
revstr = ('#'+repo.rev[:12]+(', tags:'+', '.join(revtags[0:2]) if len(revtags) else '')) if repo.rev else ''
2194-
regex_rels = regex_rels_all if all_refs else regex_rels_official
2195+
regex_rels = regex_rels_all if unstable else regex_rels_official
21952196

21962197
# Generate list of tags
21972198
rels = []
21982199
for tag in tags:
21992200
if re.match(regex_rels, tag[1]):
2200-
rels.append(tag[1] + " %s%s" % (tag[0] if verbose else "", " <- current" if tag[1] in revtags else ""))
2201+
rels.append(tag[1] + " %s%s" % (tag[0] if detailed else "", " <- current" if tag[1] in revtags else ""))
22012202

22022203
# print header
2203-
print "%s (%s)" % (prefix + (relpath(p_path, repo.path) if p_path else repo.name), ((repo.url+('#'+str(repo.rev)[:12] if repo.rev else '') if verbose else revstr) or 'no revision'))
2204+
print "%s (%s)" % (prefix + (relpath(p_path, repo.path) if p_path else repo.name), ((repo.url+('#'+str(repo.rev)[:12] if repo.rev else '') if detailed else revstr) or 'no revision'))
22042205

22052206
# print list of tags
22062207
rprefix = (prefix[:-3] + ('| ' if prefix[-3] == '|' else ' ')) if recursive and prefix else ''
@@ -2218,7 +2219,7 @@ def releases_(all_refs=False, recursive=False, prefix='', p_path=None):
22182219

22192220
if lib.check_repo():
22202221
with cd(lib.path):
2221-
releases_(all_refs, recursive, nprefix, repo.path)
2222+
releases_(detailed, unstable, recursive, nprefix, repo.path)
22222223

22232224

22242225
# Command status for cross-SCM status of repositories

0 commit comments

Comments
 (0)