CLI: list command prints in alphabetical order. Profiles can be deleted.
This commit is contained in:
parent
8094661130
commit
61f9bfabdb
1 changed files with 14 additions and 2 deletions
|
@ -227,7 +227,7 @@ def get_loaded_mods(cfg: Config) -> list:
|
|||
if entry.is_symlink() and entry.is_dir():
|
||||
# only
|
||||
ret.append(entry.name)
|
||||
return ret
|
||||
return sorted(ret, key = lambda x: x.casefold())
|
||||
|
||||
def get_available_mods(cfg: Config) -> list:
|
||||
ret = []
|
||||
|
@ -235,7 +235,7 @@ def get_available_mods(cfg: Config) -> list:
|
|||
for entry in it:
|
||||
if entry.is_dir() and entry.name != "__pycache__":
|
||||
ret.append(entry.name)
|
||||
return ret
|
||||
return sorted(ret, key = lambda x: x.casefold())
|
||||
|
||||
def enable_mod(cfg: Config, mod_name: str):
|
||||
link_source = os.path.join(cfg.mods_dir, mod_name)
|
||||
|
@ -320,6 +320,17 @@ def command_load(args: list, cfg: Config, profiles: ModProfiles):
|
|||
else:
|
||||
print(f"Usage: {args[0]} {args[1]} <profile-name>")
|
||||
|
||||
def command_delete(args: list, cfg: Config, profiles: ModProfiles):
|
||||
if len(args) > 2:
|
||||
for prof in args[2:]:
|
||||
if prof in profiles.profiles:
|
||||
del profiles.profiles[prof]
|
||||
profiles.save_mod_profiles()
|
||||
else:
|
||||
print(f"Cannot delete non-existant profile: {prof}")
|
||||
else:
|
||||
print(f"Usage: {args[0]} {args[1]} <profile-name>")
|
||||
|
||||
def command_configure(args: list, cfg: Config, profiles: ModProfiles):
|
||||
prompt_configuration_cli()
|
||||
|
||||
|
@ -335,6 +346,7 @@ def parse_input(args: list, cfg: Config, profiles: ModProfiles):
|
|||
"toggle" : command_toggle,
|
||||
"save" : command_save,
|
||||
"load" : command_load,
|
||||
"delete" : command_delete,
|
||||
"config" : command_configure,
|
||||
"help" : command_help,
|
||||
"--help" : command_help}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue