Permalink
Browse files

Added list-modified (-m) to status cmd

  • Loading branch information...
da2x committed Jun 1, 2015
1 parent 2c97f16 commit 0056c26dc5f86b8ad82675c7d0a54d62221a96c6
Showing with 15 additions and 4 deletions.
  1. +15 −4 nikola/plugins/command/status.py
@@ -49,6 +49,14 @@ class CommandDeploy(Command):
'default': False,
'help': 'List all drafts',
},
+ {
+ 'name': 'list_modified',
+ 'short': 'm',
+ 'long': 'list-modified',
+ 'type': bool,
+ 'default': False,
+ 'help': 'List all modified files since last deployment',
+ },
{
'name': 'list_scheduled',
'short': 's',
@@ -76,18 +84,21 @@ def _execute(self, options, args):
if last_deploy:
- fmod_since_deployment = 0
+ fmod_since_deployment = []
for root, dirs, files in os.walk(self.site.config["OUTPUT_FOLDER"], followlinks=True):
if not dirs and not files:
continue
for fname in files:
fpath = os.path.join(root, fname)
fmodtime = datetime.fromtimestamp(os.stat(fpath).st_mtime)
if fmodtime.replace(tzinfo=tzlocal()) > last_deploy.replace(tzinfo=gettz("UTC")).astimezone(tz=tzlocal()):
- fmod_since_deployment = fmod_since_deployment + 1
+ fmod_since_deployment.append(fpath)
- if fmod_since_deployment > 0:
- print("{0} output files modified since last deployment {1} ago.".format(str(fmod_since_deployment), self.human_time(last_deploy_offset)))
+ if len(fmod_since_deployment) > 0:
+ print("{0} output files modified since last deployment {1} ago.".format(str(len(fmod_since_deployment)), self.human_time(last_deploy_offset)))
+ if options['list_modified']:
+ for fpath in fmod_since_deployment:
+ print("Modified: '{0}'".format(fpath))
else:
print("Last deployment {0} ago.".format(self.human_time(last_deploy_offset)))

0 comments on commit 0056c26

Please sign in to comment.