Skip to content

Commit

Permalink
Version 1.5: now with readline baked in!
Browse files Browse the repository at this point in the history
Ruby is awesome.
  • Loading branch information
may committed Nov 12, 2021
1 parent 61675bd commit aa370ea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 18 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ Revised: 2021-11-09

* tput (if you don't have this, then set `$color_only` to `false` in `config.rb`)
* `apt install libncurses5` on debian/ubuntu, otherwise see: [tput](https://command-not-found.com/tput)
* running on a platform that supports readline (MacOS, GNU/Linux, *BSD, etc.)
* Otherwise set `$use_readline` to `false` in `config.rb`

## Install

Expand Down
3 changes: 0 additions & 3 deletions config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@

## User options

# Unless you're on Windows, you want this set to true.
$use_readline = true

# Extbrain uses color to denote when you need to do something or error states.
# For example, if you have a project with no next action -- it turns red.
# If you'd rather not have colors, you can turn this off with no (or limited)
Expand Down
4 changes: 2 additions & 2 deletions lib/controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ def task_input(task_action_context,task_body)
# and clearly define, for example, what the desired outcome is *now*,
# instead of just adding more text to what's already there.
# I have totally been guilty of that in the past.
#
# If you need to edit what's there, see readline or highline (if cross-platfrom needed).



def add_note(project_or_task)
print 'Add note to project or task: '
Expand Down
15 changes: 4 additions & 11 deletions main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
require_relative 'config.rb'
require_relative 'tips.rb'

if $use_readline
require "readline"
end
require 'reline' # standard ruby

# TODO steal from controller.rb around 393 inside review_and_maybe_edit
$help_text = <<HEREDOC
Expand Down Expand Up @@ -64,13 +62,8 @@ def command_loop
end

while true
if $use_readline
buf = Readline.readline('extbrain> ', true)
input = buf
else
print('extbra!n> ')
input = gets
end
buf = Reline.readline('extbrain> ', true)
input = buf
# TODO try $data.load_data BEFORE modifying state.
# TODO scope lockfile to just save load

Expand Down Expand Up @@ -214,7 +207,7 @@ def random_tip
end


puts "Welcome to extbrain, version 1.4 (\"turbochanged somedaymaybe\"), 2021-11-07"
puts "Welcome to extbrain, version 1.5 (\"now with readline\"), 2021-11-11"
startup
# random_tip #annoying, 2020-12-18
command_loop
Expand Down

0 comments on commit aa370ea

Please sign in to comment.