mirror of
https://github.com/buildinspace/peru.git
synced 2025-02-26 20:35:18 +00:00
an example of a simple list command
This commit is contained in:
parent
bda769bb4c
commit
4fabc8c224
10
peru/main.py
10
peru/main.py
@ -21,6 +21,7 @@ Usage:
|
||||
peru override [list | add <module> <path> | delete <module>]
|
||||
peru copy [-fqv] [-j N] <target> [<dest>]
|
||||
peru clean [-fv]
|
||||
peru list
|
||||
peru (help | --help | --version)
|
||||
|
||||
Commands:
|
||||
@ -29,6 +30,8 @@ Commands:
|
||||
override read from a local directory instead of fetching a module
|
||||
copy copy all the files from a module
|
||||
clean delete imports from your project
|
||||
list LISTS STUFF PROBABLY?! (Note this line doesn't actually matter
|
||||
for parsing, but the above one does.)
|
||||
|
||||
Options:
|
||||
-f --force recklessly overwrite files
|
||||
@ -134,6 +137,13 @@ class Main:
|
||||
yield from imports.checkout(
|
||||
self.runtime, self.scope, {}, self.runtime.root)
|
||||
|
||||
@command('list')
|
||||
def do_list(self):
|
||||
names = [module.name for module in self.scope.modules.values()]
|
||||
names.sort()
|
||||
for name in names:
|
||||
print(name)
|
||||
|
||||
|
||||
def get_version():
|
||||
with open(version_file) as f:
|
||||
|
Loading…
x
Reference in New Issue
Block a user