hmc 0.1.0

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 768ade725ee651c73de44d2937dddd4bd2ff51c9c559261a7130487df326610f
4
+ data.tar.gz: 642cf09962cfe72ceed018acc0b051c5bb6f7239ff1302c0c6a2ce87cd7b1f69
5
+ SHA512:
6
+ metadata.gz: 2ea51fa4f86c9f31e66c1246aedad3a08472c802d99e57e6a4e0cbd33f7f65c64a42310947d533702ab7f67e501f65ec50fcfa0b02417cf7f743d81d9a421c1f
7
+ data.tar.gz: 275afad06f2a1d9744d99c4a4d9bc3b345328b8cf5c6f9df0a34fcfb5618c2406e69aa4343f44e280f231c440aa3b95ac5b1e399d387cf262818127457c0e355
data/.rubocop.yml ADDED
@@ -0,0 +1,13 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.6
3
+
4
+ Style/StringLiterals:
5
+ Enabled: true
6
+ EnforcedStyle: double_quotes
7
+
8
+ Style/StringLiteralsInInterpolation:
9
+ Enabled: true
10
+ EnforcedStyle: double_quotes
11
+
12
+ Layout/LineLength:
13
+ Max: 120
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in hmc.gemspec
6
+ gemspec
7
+
8
+ gem "rake", "~> 13.0"
9
+
10
+ gem "rubocop", "~> 1.21"
data/Gemfile.lock ADDED
@@ -0,0 +1,54 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ hmc (0.1.0)
5
+ tty-prompt
6
+
7
+ GEM
8
+ remote: https://rubygems.org/
9
+ specs:
10
+ ast (2.4.2)
11
+ parallel (1.22.1)
12
+ parser (3.1.2.0)
13
+ ast (~> 2.4.1)
14
+ pastel (0.8.0)
15
+ tty-color (~> 0.5)
16
+ rainbow (3.1.1)
17
+ rake (13.0.6)
18
+ regexp_parser (2.3.1)
19
+ rexml (3.2.5)
20
+ rubocop (1.28.2)
21
+ parallel (~> 1.10)
22
+ parser (>= 3.1.0.0)
23
+ rainbow (>= 2.2.2, < 4.0)
24
+ regexp_parser (>= 1.8, < 3.0)
25
+ rexml
26
+ rubocop-ast (>= 1.17.0, < 2.0)
27
+ ruby-progressbar (~> 1.7)
28
+ unicode-display_width (>= 1.4.0, < 3.0)
29
+ rubocop-ast (1.17.0)
30
+ parser (>= 3.1.1.0)
31
+ ruby-progressbar (1.11.0)
32
+ tty-color (0.6.0)
33
+ tty-cursor (0.7.1)
34
+ tty-prompt (0.23.1)
35
+ pastel (~> 0.8)
36
+ tty-reader (~> 0.8)
37
+ tty-reader (0.9.0)
38
+ tty-cursor (~> 0.7)
39
+ tty-screen (~> 0.8)
40
+ wisper (~> 2.0)
41
+ tty-screen (0.8.1)
42
+ unicode-display_width (2.1.0)
43
+ wisper (2.0.1)
44
+
45
+ PLATFORMS
46
+ x86_64-linux
47
+
48
+ DEPENDENCIES
49
+ hmc!
50
+ rake (~> 13.0)
51
+ rubocop (~> 1.21)
52
+
53
+ BUNDLED WITH
54
+ 2.3.12
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 TODO: Write your name
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,35 @@
1
+ # Help Me Choose
2
+
3
+ ## CLI utility to help decide between multiple choices
4
+
5
+ Making decisions is difficult, and I'm very bad at it. This gem is a tool to help decide between any number of options. Returns one or more options out of a provided list of choices. Supports picking entirely at random, or weighting decisions if you're kinda leaning towards one or more options but you're not sure.
6
+
7
+ ## Installation
8
+
9
+ Install the gem by executing:
10
+
11
+ $ gem install hmc
12
+
13
+ ## Usage
14
+
15
+ ### Running
16
+
17
+ Open a new terminal window and run `hmc`
18
+
19
+ ### Options
20
+
21
+ #### Decision Weighting
22
+
23
+ By default, the final option(s) is picked entirely at random out of the options provided. However, if you're leaning towards some options but just aren't positive, you can adjust the likelihood of a given option being selected. By selecting `y` when asked if you're leaning towards any of the options, it will allow you to weigh each option on a scale of 1 to 10 to increase or decrease likelihood of a given option being chosen.
24
+
25
+ ### Number of decisions
26
+
27
+ By default, output will only include one option out of the list. By entering a number greater than one, you can increase the number of options to be returned. This is to accommodate for usecases such as deciding what three things to order from a restaurant out of five potential options.
28
+
29
+ ## Contributing
30
+
31
+ Bug reports and pull requests are welcome on GitHub at https://github.com/ngencokamin/hmc.
32
+
33
+ ## License
34
+
35
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rubocop/rake_task"
5
+
6
+ RuboCop::RakeTask.new
7
+
8
+ task default: :rubocop
data/bin/hmc ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require "bundler/setup"
5
+ require "hmc"
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Hmc
4
+ VERSION = "0.1.0"
5
+ end
data/lib/hmc.rb ADDED
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_relative "hmc/version"
4
+ require "tty-prompt"
5
+
6
+ module Hmc
7
+ class Error < StandardError; end
8
+ prompt = TTY::Prompt.new
9
+
10
+ puts "Hello! Welcome to Help Me Choose! :D"
11
+ prefs = prompt.no?("Are you already leaning towards any of the options?")
12
+
13
+ opt_num = prompt.ask("How many options do you want it narrowed down to?", default: "1").to_i
14
+
15
+ puts "\nPlease enter the options you're considering: "
16
+
17
+ options = []
18
+ index = 1
19
+
20
+ while true
21
+ if !prefs
22
+ weight = 0
23
+ option = prompt.ask("Please enter option #{index}:")
24
+ weight = prompt.ask("How strongly are you leaning towards #{option}? (1-10):").to_i do |q|
25
+ q.in "1-10"
26
+ end
27
+ options.fill(option, options.size, weight)
28
+ index += 1
29
+ else
30
+ option = prompt.ask("Please enter option #{index}:")
31
+ options << option
32
+ index += 1
33
+ end
34
+
35
+ printed = []
36
+
37
+ puts "\nCurrent options:\n"
38
+ options.each do |option|
39
+ unless printed.include?(option)
40
+ puts option
41
+ printed << option
42
+ end
43
+ end
44
+ puts
45
+ break unless prompt.yes?("Do you have more options to add?")
46
+ end
47
+
48
+ final_options = []
49
+
50
+ while final_options.length < (opt_num < options.length ? opt_num : options.length)
51
+ option = options.sample
52
+ final_options << option unless final_options.include?(option)
53
+ end
54
+
55
+ puts "\nFinal decision(s): \n"
56
+ final_options.each { |opt| puts "- #{opt}" }
57
+ end
data/sig/hmc.rbs ADDED
@@ -0,0 +1,4 @@
1
+ module Hmc
2
+ VERSION: String
3
+ # See the writing guide of rbs: https://github.com/ruby/rbs#guides
4
+ end
metadata ADDED
@@ -0,0 +1,70 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: hmc
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Nix Genco-Kamin
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2022-04-30 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: tty-prompt
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ description: Making decisions is difficult, and I'm very bad at it. This gem is a
28
+ tool to help decide between any number of options. Returns one or more options out
29
+ of a provided list of choices. Supports picking entirely at random, or weighting
30
+ decisions if you're kinda leaning towards one or more options but you're not sure.
31
+ email: ngencokamin@gmail.com
32
+ executables:
33
+ - hmc
34
+ extensions: []
35
+ extra_rdoc_files: []
36
+ files:
37
+ - ".rubocop.yml"
38
+ - Gemfile
39
+ - Gemfile.lock
40
+ - LICENSE.txt
41
+ - README.md
42
+ - Rakefile
43
+ - bin/hmc
44
+ - lib/hmc.rb
45
+ - lib/hmc/version.rb
46
+ - sig/hmc.rbs
47
+ homepage: ''
48
+ licenses:
49
+ - MIT
50
+ metadata: {}
51
+ post_install_message:
52
+ rdoc_options: []
53
+ require_paths:
54
+ - lib
55
+ required_ruby_version: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 2.6.0
60
+ required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ requirements: []
66
+ rubygems_version: 3.3.7
67
+ signing_key:
68
+ specification_version: 4
69
+ summary: CLI utility to help decide between multiple choices
70
+ test_files: []