Improve CLI story handling slightly
This commit is contained in:
parent
b7048dc565
commit
3c707d39ec
1 changed files with 3 additions and 3 deletions
|
|
@ -52,7 +52,7 @@ class FicTracker::Cli::Story < Thor
|
||||||
}.compact
|
}.compact
|
||||||
found = FicTracker::Models::Story.where(**search)
|
found = FicTracker::Models::Story.where(**search)
|
||||||
|
|
||||||
if found.size > 1 && !story.start_with?('*/')
|
if found.count > 1 && !story.start_with?('*/')
|
||||||
puts "Found multiple potential stories for #{story}, please specify which ones to remove using the syntax <backend>/<story>: (use */<story> to remove all)"
|
puts "Found multiple potential stories for #{story}, please specify which ones to remove using the syntax <backend>/<story>: (use */<story> to remove all)"
|
||||||
found.each do |f|
|
found.each do |f|
|
||||||
puts " - #{f.backend_name}/#{f.slug} - #{f}"
|
puts " - #{f.backend_name}/#{f.slug} - #{f}"
|
||||||
|
|
@ -69,9 +69,9 @@ class FicTracker::Cli::Story < Thor
|
||||||
desc 'list', 'List all tracked stories'
|
desc 'list', 'List all tracked stories'
|
||||||
def list
|
def list
|
||||||
setup!
|
setup!
|
||||||
info = [['Story', 'Chapters', 'Completed', 'Last Updated'], ['-----','--------','---------','------------']]
|
info = [['Slug', 'Story', 'Chapters', 'Completed', 'Last Updated'], ['----','-----','--------','---------','------------']]
|
||||||
FicTracker::Models::Story.order_by(:name).each do |story|
|
FicTracker::Models::Story.order_by(:name).each do |story|
|
||||||
info << [story.name, story.chapters.size, story.completed?, (story.updated_at || story.published_at).strftime("%F")]
|
info << [story.slug, story.name, story.chapters.size, story.completed?, (story.updated_at || story.published_at).strftime("%F")]
|
||||||
end
|
end
|
||||||
print_table info
|
print_table info
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue