Skip to content

Commit 5588277

Browse files
committed
added `installed command
1 parent c74d1c2 commit 5588277

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

README.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ Lists available templates on the index whose name contains the specified text.
128128
Downloads the specified template to your ``~/.pypackager/`` directory.
129129

130130
If a URL is specified, downloads the template from there instead of using the index.
131+
132+
``installed``
133+
~~~~~~~~~~~~~
134+
135+
Lists templates that are already been downloaded.
136+
131137
``remove``
132138
~~~~~~~~~~
133139

pypackager/channel.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ def fetch(self):
3333
response = urlopen(self.channel_url)
3434
return json.loads(response.read())
3535

36+
@property
37+
def installed_list(self):
38+
templates = [d for d in os.listdir(self.templates_dir) if os.path.isdir(os.path.join(self.templates_dir, d))]
39+
templates.sort()
40+
return templates
41+
42+
def installed(self):
43+
for name in self.installed_list:
44+
print(name)
45+
print("%d templates installed." % len(self.installed_list))
46+
3647
@property
3748
def template_list(self):
3849
return self.data.keys()

pypackager/packager.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ def create(self, package_name, *args):
1818
creator = PackageCreator(settings=self.settings)
1919
creator.create(package_name, destination)
2020

21+
def installed(self, *args):
22+
channel = PackagerChannel(settings=self.settings)
23+
channel.installed()
24+
2125
def list(self, *args):
2226
channel = PackagerChannel(settings=self.settings)
2327
channel.list()

0 commit comments

Comments
 (0)