def delete(date, latest): """Delete specified posts.""" names = posts.listPosts() if latest and names: if click.confirm('Delete %s?' % names[0]): posts.deleteFile(names[0]) print('* %s deleted.' % names[0]) names = names[1:] if date and names: for name in names: if any(name.startswith(d.strftime('%Y-%m-%d')) for d in date): if click.confirm('Delete %s?' % name): posts.deleteFile(name) print('* %s deleted.' % name)
def list(): """List posts.""" for name in posts.listPosts(): print(name)