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
dict(name='on', nargs='?', help='Turn repository caching on. Will use either a default cache location or the specified cache directory to store repositories.'),
2783
+
dict(name='on', nargs='?', help='Turn repository caching on. Will use either the default or the user specified cache directory.'),
2784
2784
dict(name='off', nargs='?', help='Turn repository caching off. Note that this doesn\'t purge cached repositories. See "purge".'),
dict(name='dir', nargs='?', help='Set cache directory. Set to "default" to let mbed CLI determine the cache directory location. Typically this is "~/.mbed/mbed-cache/" on UNIX, or "%%userprofile%%/.mbed/mbed-cache/" on Windows.'),
2786
+
dict(name='ls', nargs='?', help='List cached repositories and their sizes.'),
2786
2787
dict(name='purge', nargs='?', help='Purge cached repositories. Note that this doesn\'t turn caching off'),
2787
-
dict(name=['-D', '--dir'], dest='cache_dir', help='Set cache directory. Set to "default" to let mbed CLI determine the cache directory location.'),
action("Repository cache is now %s."%str(cfg['cache']).upper())
2815
2803
action("Cache location \"%s\""%cfg['cache_dir'])
2804
+
elifcmd=='dir':
2805
+
ifnotargument:
2806
+
error("Please specify directory or path to cache repositories. Alternatively specify \"default\" to cache repositories in the default user home location.")
2807
+
ifnotos.path.exists(argument):
2808
+
try:
2809
+
os.makedirs(argument)
2810
+
except (IOError, ImportError, OSError):
2811
+
error("Unable to create cache directory \"%s\""%argument, 128)
2812
+
elifnotos.path.isdir(argument):
2813
+
error("The specified location \"%s\" is not a directory"%argument, 128)
2814
+
eliflen(os.listdir(argument)) >1:
2815
+
warning("Directory \"%s\" is not empty."%argument)
2816
+
g.set_cfg('CACHE_DIR', argument)
2817
+
action('Repository cache location set to \"%s\"'%argument)
2816
2818
elifcmd=='ls':
2817
2819
defget_size_(path):
2818
2820
size=0
2819
2821
fordirpath, dirs, filesinos.walk(path):
2820
2822
forfinfiles:
2821
2823
size+=os.path.getsize(os.path.join(dirpath, f))
2822
2824
returnsize
2823
-
2824
2825
action("Listing cached repositories in \"%s\""%cfg['cache_base'])
0 commit comments