mirror of https://github.com/Calamitous/iris.git
Add `info` command to interactive interface
This commit is contained in:
parent
51ab0b3a7c
commit
f741e157c7
13
README.md
13
README.md
|
@ -49,6 +49,7 @@ jimmy_foo@ctrl-c.club>
|
|||
* [[r]eply](#reply)
|
||||
* [[f]reshen](#freshen)
|
||||
* [reset OR clear](#reset-or-clear)
|
||||
* [[i]nfo](#info)
|
||||
* [[h]elp](#help)
|
||||
|
||||
#### [t]opics
|
||||
|
@ -160,6 +161,18 @@ This command reloads all users' message files to get any new messages that might
|
|||
|
||||
This clears the screen and resets the cursor. If you experience screen corruption due to wide characters or terminal resizing, this may fix your visual issues.
|
||||
|
||||
#### [i]nfo
|
||||
`info, i - Display Iris version and message stats`
|
||||
|
||||
```
|
||||
jennie_minnie@ctrl-c.club~> info
|
||||
|
||||
Iris 1.0.5
|
||||
13 topics, 0 unread.
|
||||
50 messages, 0 unread.
|
||||
10 authors.
|
||||
```
|
||||
|
||||
#### [h]elp
|
||||
`help, h, ? - Display this text`
|
||||
|
||||
|
|
31
iris.rb
31
iris.rb
|
@ -416,7 +416,7 @@ class Display
|
|||
end
|
||||
|
||||
class Interface
|
||||
ONE_SHOTS = %w{help topics compose quit freshen reset_display reply}
|
||||
ONE_SHOTS = %w{help topics compose quit freshen reset_display reply info}
|
||||
CMD_MAP = {
|
||||
't' => 'topics',
|
||||
'topics' => 'topics',
|
||||
|
@ -433,6 +433,8 @@ class Interface
|
|||
'f' => 'freshen',
|
||||
'reset' => 'reset_display',
|
||||
'clear' => 'reset_display',
|
||||
'i' => 'info',
|
||||
'info ' => 'info',
|
||||
}
|
||||
|
||||
def browsing_handler(line)
|
||||
|
@ -451,6 +453,21 @@ class Interface
|
|||
Display.say `tput reset`.chomp
|
||||
end
|
||||
|
||||
def self.info
|
||||
Display.flowerbox(
|
||||
"Iris #{Config::VERSION}",
|
||||
"#{Corpus.topics.size} #{'topic'.pluralize(Corpus.topics.size)}, #{Corpus.unread_topics.size} unread.",
|
||||
"#{Corpus.size} #{'message'.pluralize(Corpus.size)}, #{Corpus.unread_messages.size} unread.",
|
||||
"#{Corpus.all.map(&:author).uniq.size} authors.",
|
||||
box_thickness: 0)
|
||||
end
|
||||
|
||||
def info
|
||||
Display.say
|
||||
Interface.info
|
||||
Display.say
|
||||
end
|
||||
|
||||
def reply(topic_id = nil)
|
||||
topic_id ||= @reply_topic
|
||||
unless topic_id
|
||||
|
@ -583,10 +600,11 @@ class Interface
|
|||
'help, h, ? - Display this text',
|
||||
'topics, t - List all topics',
|
||||
'# (topic id) - Read specified topic',
|
||||
'compose, c - Add a new topic',
|
||||
'compose, c - Add a new topic',
|
||||
'reply #, r # - Reply to a specific topic',
|
||||
'freshen, f - Reload to get any new messages',
|
||||
'reset, clear - Fix screen in case of text corruption',
|
||||
'info, i - Display Iris version and message stats',
|
||||
box_character: '')
|
||||
end
|
||||
|
||||
|
@ -627,7 +645,7 @@ class CLI
|
|||
'========',
|
||||
'--help, -h - Display this text.',
|
||||
'--version, -v - Display the current version of Iris.',
|
||||
'--stats, -s - Display data about the system.',
|
||||
'--stats, -s - Display Iris version and message stats.',
|
||||
'--interactive, -i - Enter interactive mode (default)',
|
||||
'--dump, -d - Dump entire message corpus out.',
|
||||
'',
|
||||
|
@ -648,12 +666,7 @@ class CLI
|
|||
|
||||
if (args & %w{-s --stats}).any?
|
||||
Corpus.load
|
||||
Display.flowerbox(
|
||||
"Iris #{Config::VERSION}",
|
||||
"#{Corpus.topics.size} #{'topic'.pluralize(Corpus.topics.size)}, #{Corpus.unread_topics.size} unread.",
|
||||
"#{Corpus.size} #{'message'.pluralize(Corpus.size)}, #{Corpus.unread_messages.size} unread.",
|
||||
"#{Corpus.all.map(&:author).uniq.size} authors.",
|
||||
box_thickness: 0)
|
||||
Interface.info
|
||||
exit(0)
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue