You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6
Original file line number
Diff line number
Diff line change
@@ -879,6 +879,12 @@ For safety reasons, Mbed CLI uses the `mbed-cache` subfolder to a user specified
879
879
880
880
**Security notice**: If you use cache location outside your user home/profile directory, then other system users might be able to access the repository cache and therefore the data of the cached repositories.
881
881
882
+
### Offline mode
883
+
884
+
Through the caching feature in Mbed CLI, you can enable offline mode, which uses the already cached repositories on your system. You can enable offline mode by adding the `--offline` switch to `mbed import`, `mbed add`, `mbed update` and `mbed new`.
885
+
886
+
In offline mode, Mbed CLI looks up locally cached repositories and uses them without fetching new content from their remote repositories. This is particularly useful if for example you are in a plane and you'd like to create another Mbed OS project (assuming you've imported or created one before), but you don't have access to the internet. By using the command `mbed new <project_name> --offline`, you can create the project with Mbed OS included.
887
+
882
888
## Mbed CLI configuration
883
889
884
890
You can streamline many options in Mbed CLI with global and local configuration.
error("Unable to clone repository \"%s\" in offline mode ('--offline' used)."%url)
1241
+
ifos.path.isdir(path):
1242
+
rmtree_readonly(path)
1243
+
1228
1244
returnFalse
1229
1245
1230
1246
defgetlibs(self):
@@ -1816,14 +1832,16 @@ def thunk(parsed_args):
1816
1832
dict(name='--create-only', action='store_true', help='Only create a program, do not import mbed-os or mbed library.'),
1817
1833
dict(name='--depth', nargs='?', help='Number of revisions to fetch the mbed OS repository when creating new program. Default: all revisions.'),
1818
1834
dict(name='--protocol', nargs='?', help='Transport protocol when fetching the mbed OS repository when creating new program. Supported: https, http, ssh, git. Default: inferred from URL.'),
1835
+
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
1819
1836
help='Create new mbed program or library',
1820
1837
description=(
1821
1838
"Creates a new mbed program if executed within a non-program location.\n"
1822
1839
"Alternatively creates an mbed library if executed within an existing program.\n"
1823
1840
"When creating new program, the latest mbed-os release will be downloaded/added\n unless --create-only is specified.\n"
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
1901
1919
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
1902
1920
dict(name='--insecure', action='store_true', help='Allow insecure repository URLs. By default mbed CLI imports only "safe" URLs, e.g. based on standard ports - 80, 443 and 22. This option enables the use of arbitrary URLs/ports.'),
1921
+
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
1903
1922
hidden_aliases=['im', 'imp'],
1904
1923
help='Import program from URL',
1905
1924
description=(
1906
1925
"Imports mbed program and its dependencies from a source control based URL\n"
1907
1926
"(GitHub, Bitbucket, mbed.org) into the current directory or specified\npath.\n"
1908
1927
"Use 'mbed add <URL>' to add a library into an existing program."))
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
1977
1997
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
1978
1998
dict(name='--insecure', action='store_true', help='Allow insecure repository URLs. By default mbed CLI imports only "safe" URLs, e.g. based on standard ports - 80, 443 and 22. This option enables the use of arbitrary URLs/ports.'),
1999
+
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
1979
2000
hidden_aliases=['ad'],
1980
2001
help='Add library from URL',
1981
2002
description=(
1982
2003
"Adds mbed library and its dependencies from a source control based URL\n"
1983
2004
"(GitHub, Bitbucket, mbed.org) into an existing program.\n"
1984
2005
"Use 'mbed import <URL>' to import as a program"))
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
2024
2046
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
2025
2047
dict(name='--insecure', action='store_true', help='Allow insecure repository URLs. By default mbed CLI imports only "safe" URLs, e.g. based on standard ports - 80, 443 and 22. This option enables the use of arbitrary URLs/ports.'),
2048
+
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
2026
2049
help='Find and add missing libraries',
2027
2050
description=(
2028
2051
"Import missing dependencies in an existing program or library.\n"
2029
2052
"Use 'mbed import <URL>' and 'mbed add <URL>' instead of cloning manually and\n"
dict(name='--depth', nargs='?', help='Number of revisions to fetch from the remote repository. Default: all revisions.'),
2109
2133
dict(name='--protocol', nargs='?', help='Transport protocol for the source control management. Supported: https, http, ssh, git. Default: inferred from URL.'),
2110
2134
dict(name='--insecure', action='store_true', help='Allow insecure repository URLs. By default mbed CLI imports only "safe" URLs, e.g. based on standard ports - 80, 443 and 22. This option enables the use of arbitrary URLs/ports.'),
2135
+
dict(name='--offline', action='store_true', help='Offline mode will force the use of locally cached repositories and prevent requests to remote repositories.'),
2111
2136
dict(name=['-l', '--latest-deps'], action='store_true', help='Update all dependencies to the latest revision of their current branch. WARNING: Ignores lib files'),
2112
2137
hidden_aliases=['up'],
2113
2138
help='Update to branch, tag, revision or latest',
2114
2139
description=(
2115
2140
"Updates the current program or library and its dependencies to specified\nbranch, tag or revision.\n"
2116
2141
"Alternatively fetches from associated remote repository URL and updates to the\n"
0 commit comments