mirror of
https://github.com/radareorg/r2env.git
synced 2026-11-12 16:14:29 -10:00
Compare commits
5
Commits
minor_fixes
...
fix-ci
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ac673316c9 | ||
|
|
02e188bf70 | ||
|
|
6a702b428d | ||
|
|
a8118544e3 | ||
|
|
740f66ab9b |
No files matched your search
+7
-2
@@ -35,7 +35,8 @@ class R2Env:
|
||||
print_console(" [*] {0} ({1})".format(r2_version, r2_path))
|
||||
|
||||
def show_config(self):
|
||||
return json.dumps(self._config)
|
||||
print_console("[*] Current r2env config:")
|
||||
print_console(json.dumps(self._config))
|
||||
|
||||
def list_available_packages(self):
|
||||
print_console("[*] List of available Radare packages")
|
||||
@@ -70,8 +71,12 @@ class R2Env:
|
||||
return
|
||||
self._package_manager.uninstall_package(package)
|
||||
|
||||
def use(self, package):
|
||||
def use(self, package=None):
|
||||
self.exit_if_r2env_not_initialized()
|
||||
if not package:
|
||||
print_console("[x] Package not defined. Please use 'r2env use' with one installed package. ", ERROR)
|
||||
self.list_installed_packages()
|
||||
return
|
||||
cur_ver = self._get_current_version()
|
||||
new_dst_dir = self._package_manager.get_package_path(package)
|
||||
if cur_ver:
|
||||
|
||||
+8
-3
@@ -47,7 +47,7 @@ def run_action(action, args, use_meson):
|
||||
print_console("[X] Action not found", ERROR)
|
||||
return
|
||||
if action in actions_with_argument:
|
||||
exit_if_not_argument_is_set(args)
|
||||
exit_if_not_argument_is_set(args, action)
|
||||
if action == "install":
|
||||
actions[action](args[0], use_meson=use_meson)
|
||||
else:
|
||||
@@ -56,9 +56,14 @@ def run_action(action, args, use_meson):
|
||||
actions[action]()
|
||||
|
||||
|
||||
def exit_if_not_argument_is_set(args):
|
||||
def exit_if_not_argument_is_set(args, action):
|
||||
if len(args) < 1:
|
||||
print_console("[x] Missing package argument.", ERROR)
|
||||
if action == "use":
|
||||
print_console("[x] Package not defined. Please use 'r2env use' with one installed package. ", ERROR)
|
||||
actions["versions"]()
|
||||
else:
|
||||
print_console("[x] Missing package argument. ( as for example: radare2@latest)", ERROR)
|
||||
print_console("[x] Missing package argument. ( as for example: radare2@latest)", ERROR)
|
||||
sys.exit(-1)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user