@@ -1390,7 +1390,7 @@ def thunk(parsed_args):
1390
1390
help = 'Create new mbed program or library' ,
1391
1391
description = (
1392
1392
"Creates a new mbed program if executed within a non-program location.\n "
1393
- "Alternatively creates an mbed library if executed within an existing() program.\n "
1393
+ "Alternatively creates an mbed library if executed within an existing program.\n "
1394
1394
"When creating new program, the latest mbed-os release will be downloaded/added\n unless --create-only is specified.\n "
1395
1395
"Supported source control management: git, hg" ))
1396
1396
def new (name , scm = 'git' , program = False , library = False , mbedlib = False , create_only = False , depth = None , protocol = None ):
@@ -1462,7 +1462,9 @@ def new(name, scm='git', program=False, library=False, mbedlib=False, create_onl
1462
1462
dict (name = '--protocol' , nargs = '?' , help = 'Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.' ),
1463
1463
help = 'Import program from URL' ,
1464
1464
description = (
1465
- "Imports mbed program and its dependencies from a source control based URL\n (GitHub, Bitbucket, mbed.org) into the current directory or\n specified path.\n Use 'mbed add <URL>' to add a library into an existing program." ))
1465
+ "Imports mbed program and its dependencies from a source control based URL\n "
1466
+ "(GitHub, Bitbucket, mbed.org) into the current directory or specified\n path.\n "
1467
+ "Use 'mbed add <URL>' to add a library into an existing program." ))
1466
1468
def import_ (url , path = None , ignore = False , depth = None , protocol = None , top = True ):
1467
1469
global cwd_root
1468
1470
@@ -1545,8 +1547,10 @@ def add(url, path=None, ignore=False, depth=None, protocol=None, top=True):
1545
1547
# Remove library
1546
1548
@subcommand ('remove' ,
1547
1549
dict (name = 'path' , help = 'Local library name or path' ),
1548
- description = 'Remove specified library and its dependencies from the current %s.' % cwd_type ,
1549
- help = 'Remove library' )
1550
+ help = 'Remove library' ,
1551
+ description = (
1552
+ "Remove specified library, its dependencies and references from the current\n "
1553
+ "You can re-add the library from it's URL via 'mbed add <library URL>'." ))
1550
1554
def remove (path ):
1551
1555
repo = Repo .fromrepo ()
1552
1556
if not Repo .isrepo (path ):
@@ -1564,8 +1568,11 @@ def remove(path):
1564
1568
dict (name = ['-I' , '--ignore' ], action = 'store_true' , help = 'Ignore errors related to cloning and updating.' ),
1565
1569
dict (name = '--depth' , nargs = '?' , help = 'Number of revisions to fetch from the remote repository. Default: all revisions.' ),
1566
1570
dict (name = '--protocol' , nargs = '?' , help = 'Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.' ),
1567
- description = 'Import missing dependencies in the current program or library.' ,
1568
- help = 'Find and add missing libraries' )
1571
+ help = 'Find and add missing libraries' ,
1572
+ description = (
1573
+ "Import missing dependencies in an existing program or library.\n "
1574
+ "Use 'mbed import <URL>' and 'mbed add <URL>' instead of cloning manually and\n "
1575
+ "then running 'mbed deploy'" ))
1569
1576
def deploy (ignore = False , depth = None , protocol = None , top = True ):
1570
1577
repo = Repo .fromrepo ()
1571
1578
repo .ignores ()
@@ -1585,9 +1592,14 @@ def deploy(ignore=False, depth=None, protocol=None, top=True):
1585
1592
1586
1593
# Publish command
1587
1594
@subcommand ('publish' ,
1588
- dict (name = ['-A' , '--all' ], action = 'store_true' , help = 'Publish all branches, including new. Default: push only the current branch.' ),
1589
- description = 'Publish current %s and its dependencies to associated remote repository URLs.' % cwd_type ,
1590
- help = 'Publish program or library' )
1595
+ dict (name = ['-A' , '--all' ], action = 'store_true' , help = 'Publish all branches, including new ones. Default: push only the current branch.' ),
1596
+ help = 'Publish program or library' ,
1597
+ description = (
1598
+ "Publishes this %s and all dependencies to their associated remote\n repository URLs.\n "
1599
+ "This command performs various consistency checks for local uncommitted changes\n "
1600
+ "and unpublished revisions and encourages to commit/push them.\n "
1601
+ "Online guide about collaboration is available at:\n "
1602
+ "www.mbed.com/collab_guide" % cwd_type ))
1591
1603
def publish (all = None , top = True ):
1592
1604
if top :
1593
1605
action ("Checking for local modifications..." )
@@ -1629,8 +1641,11 @@ def publish(all=None, top=True):
1629
1641
dict (name = ['-I' , '--ignore' ], action = 'store_true' , help = 'Ignore errors related to unpublished libraries, unpublished or uncommitted changes, and attempt to update from associated remote repository URLs.' ),
1630
1642
dict (name = '--depth' , nargs = '?' , help = 'Number of revisions to fetch from the remote repository. Default: all revisions.' ),
1631
1643
dict (name = '--protocol' , nargs = '?' , help = 'Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.' ),
1632
- description = 'Update current %s and its dependencies from associated remote repository URLs.' % cwd_type ,
1633
- help = 'Update to branch, tag, revision or latest' )
1644
+ help = 'Update to branch, tag, revision or latest' ,
1645
+ description = (
1646
+ "Updates this %s and its dependencies to specified branch, tag or revision.\n "
1647
+ "Alternatively fetches from associated remote repository URL and updates to the\n "
1648
+ "latest revision in the current branch." % cwd_type ))
1634
1649
def update (rev = None , clean = False , force = False , ignore = False , top = True , depth = None , protocol = None ):
1635
1650
if top and clean :
1636
1651
sync ()
@@ -1724,8 +1739,11 @@ def update(rev=None, clean=False, force=False, ignore=False, top=True, depth=Non
1724
1739
1725
1740
# Synch command
1726
1741
@subcommand ('sync' ,
1727
- description = 'Synchronize dependency references (.lib files) in the current %s.' % cwd_type ,
1728
- help = 'Synchronize library references' )
1742
+ help = 'Synchronize library references' ,
1743
+ description = (
1744
+ "Synchronizes all library and dependency references (.lib files) in the\n "
1745
+ "current %s.\n "
1746
+ "Note that this will remove all invalid library references." % cwd_type ))
1729
1747
def sync (recursive = True , keep_refs = False , top = True ):
1730
1748
if top and recursive :
1731
1749
action ("Synchronizing dependency references..." )
@@ -1783,8 +1801,9 @@ def sync(recursive=True, keep_refs=False, top=True):
1783
1801
@subcommand ('ls' ,
1784
1802
dict (name = ['-a' , '--all' ], action = 'store_true' , help = 'List repository URL and revision pairs' ),
1785
1803
dict (name = ['-I' , '--ignore' ], action = 'store_true' , help = 'Ignore errors related to missing libraries.' ),
1786
- description = 'View the current %s dependency tree.' % cwd_type ,
1787
- help = 'View library tree' )
1804
+ help = 'View dependency tree' ,
1805
+ description = (
1806
+ "View the dependency tree in this %s." % cwd_type ))
1788
1807
def list_ (all = False , prefix = '' , p_path = None , ignore = False ):
1789
1808
repo = Repo .fromrepo ()
1790
1809
print prefix + (relpath (p_path , repo .path ) if p_path else repo .name ), '(%s)' % ((repo .fullurl if all else repo .rev ) or 'no revision' )
@@ -1804,8 +1823,9 @@ def list_(all=False, prefix='', p_path=None, ignore=False):
1804
1823
# Command status for cross-SCM status of repositories
1805
1824
@subcommand ('status' ,
1806
1825
dict (name = ['-I' , '--ignore' ], action = 'store_true' , help = 'Ignore errors related to missing libraries.' ),
1807
- description = 'Show changes status of the current %s and its dependencies.' % cwd_type ,
1808
- help = 'Show version control status\n \n ' )
1826
+ help = 'Show version control status\n \n ' ,
1827
+ description = (
1828
+ "Show uncommitted changes in this %s and its dependencies." % cwd_type ))
1809
1829
def status_ (ignore = False ):
1810
1830
repo = Repo .fromrepo ()
1811
1831
if repo .dirty ():
@@ -1822,16 +1842,16 @@ def status_(ignore=False):
1822
1842
@subcommand ('compile' ,
1823
1843
dict (name = ['-t' , '--toolchain' ], help = 'Compile toolchain. Example: ARM, uARM, GCC_ARM, IAR' ),
1824
1844
dict (name = ['-m' , '--mcu' ], help = 'Compile target. Example: K64F, NUCLEO_F401RE, NRF51822...' ),
1825
- dict (name = '--source' , action = 'append' , help = 'Source directory. Default: . (current dir)' ),
1826
- dict (name = '--build' , help = 'Build directory. Default: .build/' ),
1827
1845
dict (name = '--library' , dest = 'compile_library' , action = 'store_true' , help = 'Compile the current %s as a static library.' % cwd_type ),
1828
1846
dict (name = '--config' , dest = 'compile_config' , help = 'Show run-time compile configuration' ),
1829
1847
dict (name = '--prefix' , dest = 'config_prefix' , action = 'append' , help = 'Restrict listing to parameters that have this prefix' ),
1830
1848
dict (name = '--tests' , dest = 'compile_tests' , action = 'store_true' , help = 'Compile tests in TESTS directory.' ),
1849
+ dict (name = '--source' , action = 'append' , help = 'Source directory. Default: . (current dir)' ),
1850
+ dict (name = '--build' , help = 'Build directory. Default: .build/' ),
1831
1851
dict (name = ['-c' , '--clean' ], action = 'store_true' , help = 'Clean the build directory before compiling' ),
1832
1852
dict (name = ['-S' , '--supported' ], dest = 'supported' , action = 'store_true' , help = 'Shows supported matrix of targets and toolchains' ),
1833
- description = 'Compile program using the native mbed OS build system. ' ,
1834
- help = ' Compile program using the mbed build tools' )
1853
+ help = 'Compile this program using the mbed build tools ' ,
1854
+ description = ( " Compile this program using the mbed build tools." ) )
1835
1855
def compile (toolchain = None , mcu = None , source = False , build = False , compile_library = False , compile_config = False , config_prefix = None , compile_tests = False , clean = False , supported = False ):
1836
1856
# Gather remaining arguments
1837
1857
args = remainder
@@ -1879,6 +1899,7 @@ def compile(toolchain=None, mcu=None, source=False, build=False, compile_library
1879
1899
popen (['python' , '-u' , os .path .join (tools_dir , 'build.py' )]
1880
1900
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
1881
1901
+ ['-t' , tchain , '-m' , target ]
1902
+ + (['-c' ] if clean else [])
1882
1903
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
1883
1904
+ ['--build' , build ]
1884
1905
+ (['-v' ] if verbose else [])
@@ -1892,6 +1913,7 @@ def compile(toolchain=None, mcu=None, source=False, build=False, compile_library
1892
1913
popen (['python' , '-u' , os .path .join (tools_dir , 'make.py' )]
1893
1914
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
1894
1915
+ ['-t' , tchain , '-m' , target ]
1916
+ + (['-c' ] if clean else [])
1895
1917
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
1896
1918
+ ['--build' , build ]
1897
1919
+ (['-v' ] if verbose else [])
@@ -1952,8 +1974,9 @@ def test_(list_tests=False, compile_tests=False, test_spec="test_spec.json"):
1952
1974
@subcommand ('export' ,
1953
1975
dict (name = ['-i' , '--ide' ], help = 'IDE to create project files for. Example: UVISION,DS5,IAR' , required = True ),
1954
1976
dict (name = ['-m' , '--mcu' ], help = 'Export for target MCU. Example: K64F, NUCLEO_F401RE, NRF51822...' ),
1955
- description = 'Generate project files for desktop IDEs for the current program.' ,
1956
- help = 'Generate an IDE project' )
1977
+ help = 'Generate an IDE project' ,
1978
+ description = (
1979
+ "Generate IDE project files for the current program." ))
1957
1980
def export (ide = None , mcu = None ):
1958
1981
# Gather remaining arguments
1959
1982
args = remainder
@@ -1976,8 +1999,10 @@ def export(ide=None, mcu=None):
1976
1999
1977
2000
# Test command
1978
2001
@subcommand ('detect' ,
1979
- description = 'Detect mbed targets/boards connected to this system.' ,
1980
- help = 'Detect connected mbed targets/boards\n \n ' )
2002
+ help = 'Detect connected mbed targets/boards\n \n ' ,
2003
+ description = (
2004
+ "Detects mbed targets/boards connected to this system and shows supported\n "
2005
+ "toolchain matrix." ))
1981
2006
def detect ():
1982
2007
# Gather remaining arguments
1983
2008
args = remainder
@@ -2001,8 +2026,12 @@ def detect():
2001
2026
dict (name = 'value' , nargs = '?' , help = 'Value. Will show the currently set default value for a variable if not specified.' ),
2002
2027
dict (name = ['-G' , '--global' ], dest = 'global_cfg' , action = 'store_true' , help = 'Use global settings, not local' ),
2003
2028
dict (name = ['-U' , '--unset' ], dest = 'unset' , action = 'store_true' , help = 'Unset the specified variable.' ),
2004
- description = 'Set or get global options for all programs. Global options may be overridden by program defaults.' ,
2005
- help = 'Tool configuration' )
2029
+ help = 'Tool configuration' ,
2030
+ description = (
2031
+ "Gets, sets or unsets mbed tool configuration options.\n "
2032
+ "Options can be global (via the --global switch) or local (per program)\n "
2033
+ "Global options are always overridden by local/program options.\n "
2034
+ "Currently supported options: target, toolchain, protocol, depth, cache" ))
2006
2035
def config_ (var , value = None , global_cfg = False , unset = False ):
2007
2036
name = var
2008
2037
var = str (var ).upper ()
@@ -2037,15 +2066,20 @@ def config_(var, value=None, global_cfg=False, unset=False):
2037
2066
# Build system and exporters
2038
2067
@subcommand ('target' ,
2039
2068
dict (name = 'name' , nargs = '?' , help = 'Default target name. Example: K64F, NUCLEO_F401RE, NRF51822...' ),
2040
- help = 'Set default target for the current program.' )
2041
- def target_ (name = None ):
2042
- return default_ ('target' , name )
2069
+ dict (name = ['-G' , '--global' ], dest = 'global_cfg' , action = 'store_true' , help = 'Use global settings, not local' ),
2070
+ help = 'Set or get default target' ,
2071
+ description = (
2072
+ "This is an alias to 'mbed config target [--global] [name]'\n " ))
2073
+ def target_ (name = None , global_cfg = False ):
2074
+ return config_ ('target' , name , global_cfg = global_cfg )
2043
2075
2044
2076
@subcommand ('toolchain' ,
2045
2077
dict (name = 'name' , nargs = '?' , help = 'Default toolchain name. Example: ARM, uARM, GCC_ARM, IAR' ),
2046
- help = 'Set default toolchain for the current program.' )
2047
- def toolchain_ (name = None ):
2048
- return default_ ('toolchain' , name )
2078
+ help = 'Set or get default toolchain' ,
2079
+ description = (
2080
+ "This is an alias to 'mbed config toolchain [--global] [name]'\n " ))
2081
+ def toolchain_ (name = None , global_cfg = False ):
2082
+ return config_ ('toolchain' , name , global_cfg = global_cfg )
2049
2083
2050
2084
2051
2085
# Parse/run command
0 commit comments