New status command #1741
Merged
New status command #1741
Conversation
nikola/plugins/command/status.py
Outdated
""" Site status. """ | ||
name = "status" | ||
|
||
doc_usage = "[[preset [preset...]]" |
Kwpolska
May 21, 2015
Member
not really, at least not in this iteration.
not really, at least not in this iteration.
|
||
self.site.scan_posts() | ||
|
||
timestamp_path = os.path.join(self.site.config["CACHE_FOLDER"], "lastdeploy") |
Kwpolska
May 21, 2015
Member
On a side note, does github_deploy
write to this file? If not, it should.
On a side note, does github_deploy
write to this file? If not, it should.
da2x
May 21, 2015
Author
Contributor
It does now.
It does now.
nikola/plugins/command/status.py
Outdated
if last_deploy: | ||
|
||
if last_deploy_offset.days > 0: | ||
last_deploy_offsetstr = "{0} days and {1} hours".format(str(int(last_deploy_offset.days)), str(int(last_deploy_offset.seconds / 60 / 60))) |
Kwpolska
May 21, 2015
Member
Why do you need this str(int())
dance?
Just use {0:.0f} days and {1:.0f} hours
as the format string. It will guarantee zero decimal places. Even if not for this, str.format() does not need strings as its arguments — and it’s even better to give ints and floats so you can format them more precisely.
Why do you need this str(int())
dance?
Just use {0:.0f} days and {1:.0f} hours
as the format string. It will guarantee zero decimal places. Even if not for this, str.format() does not need strings as its arguments — and it’s even better to give ints and floats so you can format them more precisely.
nikola/plugins/command/status.py
Outdated
|
||
if posts_scheduled > 0 and post_scheduled_nearest_offset is not None: | ||
if post_scheduled_nearest_offset.days > 0: | ||
nearest_scheduled_timestr = "{0} days and {1} hours".format(str(int(post_scheduled_nearest_offset.days)), str(int(post_scheduled_nearest_offset.seconds / 60 / 60))) |
Kwpolska
May 21, 2015
Member
Deduplication: write a display_time
function that takes offset
as an argument and is used for generating pretty last_deploy_offset
and post_scheduled_nearest_offset
text
Deduplication: write a display_time
function that takes offset
as an argument and is used for generating pretty last_deploy_offset
and post_scheduled_nearest_offset
text
nikola/plugins/command/status.py
Outdated
nearest_scheduled_timestr = "{0} minutes".format(str(int(((post_scheduled_nearest_offset.seconds / 60) // 60) * 60))) | ||
print("{0} to next scheduled post.".format(nearest_scheduled_timestr)) | ||
|
||
print("{0:,} posts in total, {1:,} scheduled, and {2:,} drafts.".format(posts_count, posts_scheduled, posts_drafts)) |
Kwpolska
May 21, 2015
Member
Sounds better if we used plain numbers (123456 vs 123,456) here.
Sounds better if we used plain numbers (123456 vs 123,456) here.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
From issue #1740.
Sample output:
Counting new posts is out. Tracking whether last build succeeded seemed less useful when I started working on it, so I dropped that too. Checking for version should be done in version plugin.