Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added list-modified (-m) to status cmd
  • Loading branch information
da2x committed Jun 1, 2015
1 parent 2c97f16 commit 0056c26
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions nikola/plugins/command/status.py
Expand Up @@ -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',
Expand Down Expand Up @@ -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)))

Expand Down

0 comments on commit 0056c26

Please sign in to comment.