rubiks-cli 1.4.1 → 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: 7f41af5a9687e0f977719e8e7caf798d8de975ad9c601df389bc8224a3b48d29
4
- data.tar.gz: 8bafea416886b9f1d4025f327e6120e159af25ffd333fef53426ec7bc2c5ac4f
3
+ metadata.gz: 1f9ab82b63263d5febf97737189ced411fcbe595f86b026a6958e06d2686181c
4
+ data.tar.gz: cc757c2d7ef1c4d357412d9df39b51b434b3ac1ae5869e4097e48486b5b25e19
5
5
  SHA512:
6
- metadata.gz: bca1184b5817581fff9d9d0f38b1b0409f6f46bc9f81d91b286d2ada09ed4d0cf6e06cb5ec174fd4a8c73f1ec00a335a9c92c176570a8a0e682043e13877cc12
7
- data.tar.gz: 7a741690d3d96c8878fc03d341b5b63855761ec34c0e127fb1c81bd4c22c1263ea515811834e5bea0816d9714bb74282201fad5a04ca86470a6fa488665748b8
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?
@@ -47,19 +56,19 @@ if options[:loop]
47
56
 
48
57
  if options[:time] && options[:scramble]
49
58
  RubiksCli::Loop.build(
50
- RubiksCli::Loop.create_action('', start_timer_then_output_scramble, "start solve"),
59
+ start_timer_then_output_scramble,
51
60
  [ RubiksCli::Loop.create_action('n', output_scramble, "generate new scramble"), ]
52
61
  ).start
53
62
 
54
63
  elsif options[:scramble]
55
64
  RubiksCli::Loop.build(
56
- RubiksCli::Loop.create_action('', output_scramble, "generate a scramble"),
65
+ output_scramble,
57
66
  [ RubiksCli::Loop.create_action('t', start_timer_then_output_scramble, "start timer"), ]
58
67
  ).start
59
68
 
60
69
  elsif options[:time]
61
70
  RubiksCli::Loop.build(
62
- RubiksCli::Loop.create_action('', start_timer, "start timer"),
71
+ start_timer,
63
72
  [ RubiksCli::Loop.create_action('n', output_scramble, "generate a scramble"), ]
64
73
  ).start
65
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.1"
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.1
4
+ version: 1.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Noah Scott