rubiks-cli 1.4.0 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b01173da4ddca951dac1a67a9d4eb4a872162ffebd3751fc89d30b5512128eb0
4
- data.tar.gz: fd61a5af3f725ad9d042514ba252ab206ad3ffce7758acc709c58f68ace07a69
3
+ metadata.gz: 1f9ab82b63263d5febf97737189ced411fcbe595f86b026a6958e06d2686181c
4
+ data.tar.gz: cc757c2d7ef1c4d357412d9df39b51b434b3ac1ae5869e4097e48486b5b25e19
5
5
  SHA512:
6
- metadata.gz: 288fa531855f4e33f79bf991893019614068ac46f314a250f812124927fe1752c4f4ba0544f28061014e53632c9541970c49a3007e9ec58e6d32c048ebed483e
7
- data.tar.gz: 79dfc148a7ffbe9292942346f51585f6560f45c1f2b7ed1c7dc766c3e828b9e2d043264af70cb61235b6e4a081fc54eb8b10835217743d18684589704c78f64c
6
+ metadata.gz: 87e01d0d4866e8200b81ad89daddf084bd8c629282b7acf517feaa08cf1045919587a66d2f4e7eae20c0bb8da155dc7c51440a0a34fea7b383235b1b77ff66a7
7
+ data.tar.gz: a8627c4c8ba178fed6340105404446d432d1cda295a96fc15d586ba4274a4cc337899b209258af77220a3173f7065070a1ba9001ec98648f1a568a7df37c7daf
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rubiks CLI
2
2
 
3
- A command-line Rubik's Cube timer.
3
+ A command-line Rubik's Cube timer
4
4
 
5
5
  ## Installation
6
6
 
@@ -10,12 +10,13 @@ gem install rubiks-cli
10
10
 
11
11
  ## Usage
12
12
 
13
- ```bash
14
- rubiks
15
13
  ```
16
-
17
- - Press Enter to start timing
18
- - Press any key to stop timing
19
- - Type 'n' for a new scramble
20
- - Type 'q' to quit
21
- - Type 'h' or '?' for help (this message)
14
+ rubiks [options]
15
+ -c, --clear Clear the screen before starting
16
+ -i, --inspection Include inspection time
17
+ -l, --loop Loop forever
18
+ -s, --scramble Generate scramble
19
+ -t, --time Start timer
20
+ -h, --help Show this help message
21
+ ```
22
+ Defaults: `--scramble, --time`
data/bin/rubiks CHANGED
@@ -27,6 +27,15 @@ OptionParser.new do |opts|
27
27
  options[:time] = true
28
28
  end
29
29
 
30
+ # opts.on("-o", "--overwrite", "Overwrite loop output") do
31
+ # options[:time] = true
32
+ # end
33
+
34
+ opts.on("-h", "--help", "Show this help message") do
35
+ puts opts
36
+ puts "\nDefaults: --scramble, --time"
37
+ exit
38
+ end
30
39
  end.parse!
31
40
 
32
41
  if options.values.none?
@@ -46,23 +55,20 @@ start_timer_then_output_scramble = lambda {
46
55
  if options[:loop]
47
56
 
48
57
  if options[:time] && options[:scramble]
49
- RubiksCli::Clear.screen
50
58
  RubiksCli::Loop.build(
51
- RubiksCli::Loop.create_action('', start_timer_then_output_scramble, "start solve"),
59
+ start_timer_then_output_scramble,
52
60
  [ RubiksCli::Loop.create_action('n', output_scramble, "generate new scramble"), ]
53
61
  ).start
54
62
 
55
63
  elsif options[:scramble]
56
- RubiksCli::Clear.screen
57
64
  RubiksCli::Loop.build(
58
- RubiksCli::Loop.create_action('', output_scramble, "generate a scramble"),
65
+ output_scramble,
59
66
  [ RubiksCli::Loop.create_action('t', start_timer_then_output_scramble, "start timer"), ]
60
67
  ).start
61
68
 
62
69
  elsif options[:time]
63
- RubiksCli::Clear.screen
64
70
  RubiksCli::Loop.build(
65
- RubiksCli::Loop.create_action('', start_timer, "start timer"),
71
+ start_timer,
66
72
  [ RubiksCli::Loop.create_action('n', output_scramble, "generate a scramble"), ]
67
73
  ).start
68
74
 
@@ -5,13 +5,13 @@ module RubiksCli
5
5
  class Engine
6
6
  private_class_method :new
7
7
 
8
- def initialize(action_on_enter, other_actions)
8
+ def initialize(on_enter, other_actions)
9
9
  commands = other_actions.map { |action| action.command }
10
10
  if commands.uniq.size != commands.size
11
11
  raise ArgumentError, "Duplicate command"
12
12
  end
13
13
 
14
- @actions = Hash.new(action_on_enter.function)
14
+ @actions = Hash.new(on_enter)
15
15
  other_actions.each { |action| @actions[action.command] = action.function }
16
16
  end
17
17
 
@@ -26,15 +26,3 @@ module RubiksCli
26
26
  end
27
27
  end
28
28
  end
29
-
30
- if __FILE__ == $0
31
- require_relative 'builder'
32
-
33
- on_enter = lambda { puts "You pressed Enter!" }
34
- actions = [
35
- RubiksCli::Loop.build_action('x', -> { puts "Action X executed" }, "execute action X"),
36
- RubiksCli::Loop.build_action('y', -> { puts "Action Y executed" }, "execute action Y"),
37
- ]
38
- loop_instance = RubiksCli::Loop.build_loop(on_enter, actions)
39
- loop_instance.start
40
- end
@@ -1,3 +1,3 @@
1
1
  module RubiksCli
2
- VERSION = "1.4.0"
2
+ VERSION = "1.4.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubiks-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.0
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Scott