heyterminal 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: ca68617e7fc0de5056e8dcee3dea13e276cc25dd551f24292df27fa60b42fff7
4
+ data.tar.gz: 386b8d19818ea3dab921f7094a9c659fc2a7a7ebd38bc8b1b23d8337b5433798
5
+ SHA512:
6
+ metadata.gz: 0c7e8aef300675f7d00a213f01cc03c879a244a3157c1949908fec6b5ec28da4d20ce1a847818eee2fc753c5b8e84f36cdc11ea44e766171d4e24975e821941e
7
+ data.tar.gz: 36b3c028d7b73d918f98ab726e59fc41406c2d4b0014c54a2b79354d0a93a4cc01d253db597a8e966e8c4fc52ecebff6cfdd01f56d161ffd5406c9617fb67b04
data/.gitignore ADDED
@@ -0,0 +1,13 @@
1
+ *.gem
2
+ install.sh
3
+ /.bundle/
4
+ /.yardoc
5
+ /_yardoc/
6
+ /coverage/
7
+ /doc/
8
+ /pkg/
9
+ /spec/reports/
10
+ /tmp/
11
+
12
+ # rspec failure tracking
13
+ .rspec_status
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.7.5
data/.travis.yml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ sudo: false
3
+ language: ruby
4
+ cache: bundler
5
+ rvm:
6
+ - 2.6.3
7
+ before_install: gem install bundler -v 1.17.2
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at federico.dayan@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in heyterminal.gemspec
6
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,56 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ heyterminal (0.1.0)
5
+ cucumber-cucumber-expressions (~> 14.0)
6
+ dry-cli (~> 0.4.0)
7
+ rainbow (~> 3.0.0)
8
+ terrapin (~> 0.6.0)
9
+ tty-spinner (= 0.9.3)
10
+
11
+ GEM
12
+ remote: https://rubygems.org/
13
+ specs:
14
+ climate_control (0.2.0)
15
+ concurrent-ruby (1.1.9)
16
+ cucumber-cucumber-expressions (14.0.0)
17
+ diff-lcs (1.5.0)
18
+ dry-cli (0.4.0)
19
+ concurrent-ruby (~> 1.0)
20
+ hanami-utils (~> 1.3)
21
+ hanami-utils (1.3.8)
22
+ concurrent-ruby (~> 1.0)
23
+ transproc (~> 1.0)
24
+ rainbow (3.0.0)
25
+ rake (10.5.0)
26
+ rspec (3.10.0)
27
+ rspec-core (~> 3.10.0)
28
+ rspec-expectations (~> 3.10.0)
29
+ rspec-mocks (~> 3.10.0)
30
+ rspec-core (3.10.1)
31
+ rspec-support (~> 3.10.0)
32
+ rspec-expectations (3.10.1)
33
+ diff-lcs (>= 1.2.0, < 2.0)
34
+ rspec-support (~> 3.10.0)
35
+ rspec-mocks (3.10.2)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.10.0)
38
+ rspec-support (3.10.3)
39
+ terrapin (0.6.0)
40
+ climate_control (>= 0.0.3, < 1.0)
41
+ transproc (1.1.1)
42
+ tty-cursor (0.7.1)
43
+ tty-spinner (0.9.3)
44
+ tty-cursor (~> 0.7)
45
+
46
+ PLATFORMS
47
+ ruby
48
+
49
+ DEPENDENCIES
50
+ bundler (~> 2.1.4)
51
+ heyterminal!
52
+ rake (~> 10.0)
53
+ rspec (~> 3.0)
54
+
55
+ BUNDLED WITH
56
+ 2.1.4
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2021 Federico Dayan
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,139 @@
1
+ # Heyterminal
2
+
3
+ This is just another tool for running command lines from the terminal.
4
+ I was inspired by my Google Assistance.
5
+ I just wanted to say to my terminal `hey termianl do this`.
6
+ I'm currently usign it and it's proven more usefull and friendly than running `bash` scripts or other `cli` tools like `thor`.
7
+
8
+ Basically, you will need have to create a `heyterminal.rb` and that will have your commands in a DSL format in `ruby` code. (but you don't need to know `ruby`).
9
+
10
+ for example in your `heyterminal.rb` you can have :
11
+
12
+ ```ruby
13
+ Hey("build and install gem project {projectName} with version {version}") do |name, version|
14
+ dir_path = home_file_path "projects", name
15
+ chdir(dir_path) do
16
+ run "gem build #{name}.gemspec"
17
+ run "gem installl #{name}-#{version}.gem"
18
+ end
19
+ end
20
+ ```
21
+
22
+ and you call that command from the terminal as follow:
23
+
24
+ `heytermianl run "build and install gem project heytermianl with version 0.1.0"`
25
+
26
+ * That changes directory to the `heyterminal` project
27
+ * Then builds the gem based on the name (`heyterminal`)
28
+ * Then installs the gem based on the name and the version
29
+
30
+ As common practice if you don't specify a `terminal.rb` file, it will search for a config file in this order
31
+
32
+ * current directory `./heyterminal.rb`
33
+ * home directory `~/heyterminal.rb`
34
+
35
+ if you specify a `heyterminal.rb` file passing the `--config` flag, that takes priority.
36
+
37
+ ## Installation
38
+
39
+ Add this line to your application's Gemfile:
40
+
41
+ ```ruby
42
+ gem 'heyterminal'
43
+ ```
44
+
45
+ And then execute:
46
+
47
+ $ bundle
48
+
49
+ Or install it yourself as:
50
+
51
+ $ gem install heyterminal
52
+
53
+ ## Usage
54
+
55
+ create `heyterminal.rb` file in `$HOME` directory or current directory
56
+
57
+ ```ruby
58
+ Hey(<EXPRESION>) do |arg1, arg2}
59
+ ....execute code
60
+ end
61
+ ```
62
+
63
+ `<EXPRESSION>` is using [cucumber-expression](https://github.com/cucumber/cucumber-expressions).
64
+
65
+ You can use expression or regex. Look at that documentation. Matching arguments are passed to the block.
66
+
67
+ ```ruby
68
+ Hey("deploy {projectName} to heroku") do |name|
69
+ dir_path = home_file_path "projects", name
70
+ chdir(dir_path) do
71
+ run "git push main heroku"
72
+ run "heroku run rake db:migrate"
73
+ end
74
+ end
75
+ ```
76
+
77
+ You can use any ruby code and ruby gem in `heyterminal.rb`, but this command are available to make life easier.
78
+
79
+ ### Commands available
80
+
81
+ | Command | Description |
82
+ |--------------------------|-----------------------------------------------------|
83
+ | run(*args) | Runs a command in the terminal, prints out the outout|
84
+ | capture(*args) | Runs a command in the termina, does not print out the output, it returns the output instead |
85
+ | chdir(*args) | changes directory in the termianl |
86
+ | home_file_path(*args) | returns a a file path based from the `$HOME` path |
87
+ | hey | You can call another command just as you would from the terminal"
88
+
89
+
90
+ ### Bash aliases
91
+
92
+ I suggest you create the following bash `alias` and `function`
93
+
94
+ ```
95
+ function hey { heyterminal run "$*"; }
96
+
97
+ alias ht="heyterminal"
98
+ ```
99
+
100
+ Now you can run from the terminal:
101
+
102
+ `hey deploy fancyproject to heroku`
103
+
104
+ you don't have to specify quotes (`"`).
105
+
106
+ also you can use shorcut `nt` like:
107
+
108
+ `ht list`
109
+
110
+
111
+ ### Execution
112
+
113
+ `heyterminal run "deploy fancyproject to heroku"`
114
+
115
+ ```
116
+ Commands:
117
+ heyterminal edit # Edit heytermianl.rb
118
+ heyterminal list # Lists all commands
119
+ heyterminal run [COMMAND] # Runs a command
120
+ heyterminal version # Print version
121
+ ```
122
+
123
+ ## Development
124
+
125
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
126
+
127
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
128
+
129
+ ## Contributing
130
+
131
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/heyterminal. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
132
+
133
+ ## License
134
+
135
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
136
+
137
+ ## Code of Conduct
138
+
139
+ Everyone interacting in the Heyterminal project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/heyterminal/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,6 @@
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "heyterminal"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/exe/heyterminal ADDED
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'heyterminal'
4
+
5
+ Dry::CLI.new(Heyterminal::Cli::Commands).call
@@ -0,0 +1,48 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "heyterminal/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "heyterminal"
8
+ spec.version = Heyterminal::VERSION
9
+ spec.authors = ["Federico Dayan"]
10
+ spec.email = ["federico.dayan@gmail.com"]
11
+
12
+ spec.summary = %q{A fancy command line runner that lets you tell the terminal in words what to do.}
13
+ spec.description = %q{This is just another tool for running command lines from the terminal. I was inspired by my Google Assistance to build it. I just wanted to say to my terminal hey termianl do this. I'm currently usign it and it's proven more usefull and friendly than running bash scripts or other cli tools like thor.}
14
+ spec.homepage = "https://github.com/fddayan/heyterminal"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "http://mygemserver.com"
21
+
22
+ spec.metadata["homepage_uri"] = spec.homepage
23
+ spec.metadata["source_code_uri"] = "https://github.com/fddayan/heyterminal"
24
+ spec.metadata["changelog_uri"] = "https://github.com/fddayan/heyterminal"
25
+ else
26
+ raise "RubyGems 2.0 or newer is required to protect against " \
27
+ "public gem pushes."
28
+ end
29
+
30
+ # Specify which files should be added to the gem when it is released.
31
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
32
+ spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
33
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
34
+ end
35
+ spec.bindir = "exe"
36
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
+ spec.require_paths = ["lib"]
38
+
39
+ spec.add_dependency "cucumber-cucumber-expressions", "~> 14.0"
40
+ spec.add_dependency "terrapin", "~> 0.6.0"
41
+ spec.add_dependency "rainbow", "~>3.0.0"
42
+ spec.add_dependency "dry-cli", "~>0.4.0"
43
+ spec.add_dependency "tty-spinner", "0.9.3"
44
+
45
+ spec.add_development_dependency "bundler", "~> 2.1.4"
46
+ spec.add_development_dependency "rake", "~> 10.0"
47
+ spec.add_development_dependency "rspec", "~> 3.0"
48
+ end
@@ -0,0 +1,70 @@
1
+ module Heyterminal
2
+ module Cli
3
+ module Commands
4
+ extend Dry::CLI::Registry
5
+
6
+ class Version < Heyterminal::CliCommand
7
+ desc "Print version"
8
+
9
+ def call(*)
10
+ puts Heyterminal::VERSION
11
+ end
12
+ end
13
+
14
+ class Run < Heyterminal::CliCommand
15
+ desc 'Runs a command'
16
+
17
+ argument :command, desc: 'Command to run'
18
+ option :config, type: :string, default: nil, desc: 'Heyterminal cofiguration file'
19
+
20
+ def call(command: nil, **options)
21
+ safe_call do
22
+ raise Heyterminal::Error, 'command is required' if command.nil?
23
+
24
+ puts Heyterminal::Runner.lod_and_run(options.fetch(:config, nil), command)
25
+ end
26
+ end
27
+ end
28
+
29
+ class List < Heyterminal::CliCommand
30
+ desc 'Lists all commands'
31
+
32
+ option :config, type: :string, default: nil, desc: 'Heyterminal cofiguration file'
33
+
34
+ def call(**options)
35
+ safe_call do
36
+ Heyterminal::Runner.load_default(options.fetch(:config, nil))
37
+ list = Heyterminal::Runner.expressions_commands
38
+
39
+ puts 'List of commands'
40
+ puts '-----------------'
41
+ list.each do |exp|
42
+ puts "* #{exp}"
43
+ end
44
+ end
45
+ end
46
+ end
47
+
48
+ class Edit < Heyterminal::CliCommand
49
+ desc 'Edit heytermianl.rb'
50
+
51
+ option :config, type: :string, default: nil, desc: 'Heyterminal cofiguration file'
52
+
53
+ def call(**options)
54
+ safe_call do
55
+ Heyterminal::Runner.load_default(options.fetch(:config, nil))
56
+
57
+ line = Terrapin::CommandLine.new("#{Heyterminal::Runner.editor} #{Heyterminal::Runner.file_path}")
58
+
59
+ line.run
60
+ end
61
+ end
62
+ end
63
+
64
+ register 'version', Version, aliases: ['v', '-v', '--version']
65
+ register 'run', Run
66
+ register 'list', List
67
+ register 'edit', Edit
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,11 @@
1
+ module Heyterminal
2
+ class CliCommand < Dry::CLI::Command
3
+
4
+ def safe_call
5
+ yield
6
+ rescue Heyterminal::Error => e
7
+ puts Rainbow(e.message).red
8
+ exit 2
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,44 @@
1
+ module Heyterminal
2
+ class Parser
3
+
4
+ def editor(editor)
5
+ Heyterminal::Runner.set_editor(editor)
6
+ end
7
+
8
+ def Hey(command, &block)
9
+ expression_factory = Cucumber:: CucumberExpressions::ExpressionFactory.new(Cucumber::CucumberExpressions::ParameterTypeRegistry.new)
10
+ add_expression [expression_factory.create_expression(command), block]
11
+ end
12
+
13
+ def run(*args)
14
+ line = Terrapin::CommandLine.new(*args)
15
+ puts Rainbow("[" + line.command + "]").magenta.to_s
16
+ spinner = TTY::Spinner.new
17
+ spinner.auto_spin
18
+ output = line.run
19
+ spinner.stop('Done!')
20
+ puts output
21
+ end
22
+
23
+ def hey(command)
24
+ Heyterminal::Runner.run(command)
25
+ end
26
+
27
+ def capture(*args)
28
+ line = Terrapin::CommandLine.new(*args)
29
+ line.run
30
+ end
31
+
32
+ def chdir(to, &block)
33
+ Dir.chdir(to, &block)
34
+ end
35
+
36
+ def home_file_path(*args)
37
+ File.join(Dir.home, *args)
38
+ end
39
+
40
+ def add_expression(expression)
41
+ Heyterminal::Runner.add_expression(expression)
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,92 @@
1
+ module Heyterminal
2
+ class Runner
3
+
4
+ DEFAULT_DSL_FILE_NAME = 'heyterminal.rb'.freeze
5
+
6
+ def self.set_editor(editor)
7
+ @editor = editor
8
+ end
9
+
10
+ def self.editor
11
+ @editor
12
+ end
13
+
14
+ def self.lod_and_run(file, command)
15
+ @file_path = dsl_path(file)
16
+
17
+ raise Heyterminal::Error, 'file not found in any of directories' if file_path.nil?
18
+
19
+ puts "Using... #{file_path}"
20
+ load(file_path)
21
+ run(command)
22
+ end
23
+
24
+ def self.dsl_path(file)
25
+ if file.nil? || file.empty?
26
+ file_path = File.join(Dir.pwd, "/#{DEFAULT_DSL_FILE_NAME}")
27
+
28
+ return file_path if File.exist?(file_path)
29
+
30
+ file_path = File.join(Dir.home, "/#{DEFAULT_DSL_FILE_NAME}")
31
+
32
+ return file_path if File.exist?(file_path)
33
+ else
34
+ file_path = File.join(Dir.pwd, file)
35
+
36
+ return file_path if File.exist?(file_path)
37
+ end
38
+ end
39
+
40
+ def self.load_default(file)
41
+ @file_path = dsl_path(file)
42
+ load(@file_path)
43
+ end
44
+
45
+ def self.file_path
46
+ @file_path
47
+ end
48
+
49
+ def self.load(file)
50
+ contents = File.read(file)
51
+ parser = Heyterminal::Parser.new
52
+ parser.instance_eval(contents)
53
+ parser
54
+ end
55
+
56
+ def self.add_expression(expression)
57
+ @expressions ||= []
58
+ @expressions << expression
59
+ end
60
+
61
+ def self.run(command)
62
+ result = nil
63
+ found = false
64
+ @expressions.each do |expression|
65
+ cucumber, block = expression
66
+ expression_text = cucumber.instance_variable_get('@expression')
67
+ matched = cucumber.match(command)
68
+
69
+ next if matched.nil?
70
+
71
+ puts Rainbow('=' * 20).yellow
72
+ puts Rainbow("Hey running.... #{expression_text}").yellow
73
+ puts Rainbow('=' * 20).yellow
74
+
75
+ block.call(*matched.map { |m| m.value(nil)})
76
+ found = true
77
+ break
78
+ end
79
+ raise Heyterminal::Error, "command \"#{command}\" not found in config file #{file_path}" unless found
80
+
81
+ result
82
+ end
83
+
84
+ def self.expressions
85
+ @expressions
86
+ end
87
+
88
+ def self.expressions_commands
89
+ expressions.map { |e| e[0].instance_variable_get('@expression') }
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,3 @@
1
+ module Heyterminal
2
+ VERSION = "0.1.0"
3
+ end
@@ -0,0 +1,19 @@
1
+ require 'terrapin'
2
+ require 'rainbow'
3
+ require 'tty-spinner'
4
+ require "dry/cli"
5
+ require 'cucumber/cucumber_expressions/parameter_type_registry'
6
+ require 'cucumber/cucumber_expressions/cucumber_expression'
7
+ require 'cucumber/cucumber_expressions/regular_expression'
8
+ require 'cucumber/cucumber_expressions/cucumber_expression_generator'
9
+ require 'cucumber/cucumber_expressions/expression_factory'
10
+ require "heyterminal/version"
11
+ require "heyterminal/runner"
12
+ require "heyterminal/parser"
13
+ require 'heyterminal/cli_command'
14
+ require "heyterminal/cli"
15
+
16
+ module Heyterminal
17
+ class Error < StandardError; end
18
+ # Your code goes here...
19
+ end
metadata ADDED
@@ -0,0 +1,183 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: heyterminal
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Federico Dayan
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2022-01-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cucumber-cucumber-expressions
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '14.0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '14.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: terrapin
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 0.6.0
41
+ - !ruby/object:Gem::Dependency
42
+ name: rainbow
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: 3.0.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: 3.0.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: dry-cli
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.4.0
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.4.0
69
+ - !ruby/object:Gem::Dependency
70
+ name: tty-spinner
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '='
74
+ - !ruby/object:Gem::Version
75
+ version: 0.9.3
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '='
81
+ - !ruby/object:Gem::Version
82
+ version: 0.9.3
83
+ - !ruby/object:Gem::Dependency
84
+ name: bundler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 2.1.4
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 2.1.4
97
+ - !ruby/object:Gem::Dependency
98
+ name: rake
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '10.0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '10.0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.0'
125
+ description: This is just another tool for running command lines from the terminal.
126
+ I was inspired by my Google Assistance to build it. I just wanted to say to my terminal
127
+ hey termianl do this. I'm currently usign it and it's proven more usefull and friendly
128
+ than running bash scripts or other cli tools like thor.
129
+ email:
130
+ - federico.dayan@gmail.com
131
+ executables:
132
+ - heyterminal
133
+ extensions: []
134
+ extra_rdoc_files: []
135
+ files:
136
+ - ".gitignore"
137
+ - ".rspec"
138
+ - ".ruby-version"
139
+ - ".travis.yml"
140
+ - CODE_OF_CONDUCT.md
141
+ - Gemfile
142
+ - Gemfile.lock
143
+ - LICENSE.txt
144
+ - README.md
145
+ - Rakefile
146
+ - bin/console
147
+ - bin/setup
148
+ - exe/heyterminal
149
+ - heyterminal.gemspec
150
+ - lib/heyterminal.rb
151
+ - lib/heyterminal/cli.rb
152
+ - lib/heyterminal/cli_command.rb
153
+ - lib/heyterminal/parser.rb
154
+ - lib/heyterminal/runner.rb
155
+ - lib/heyterminal/version.rb
156
+ homepage: https://github.com/fddayan/heyterminal
157
+ licenses:
158
+ - MIT
159
+ metadata:
160
+ homepage_uri: https://github.com/fddayan/heyterminal
161
+ source_code_uri: https://github.com/fddayan/heyterminal
162
+ changelog_uri: https://github.com/fddayan/heyterminal
163
+ post_install_message:
164
+ rdoc_options: []
165
+ require_paths:
166
+ - lib
167
+ required_ruby_version: !ruby/object:Gem::Requirement
168
+ requirements:
169
+ - - ">="
170
+ - !ruby/object:Gem::Version
171
+ version: '0'
172
+ required_rubygems_version: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - ">="
175
+ - !ruby/object:Gem::Version
176
+ version: '0'
177
+ requirements: []
178
+ rubygems_version: 3.1.6
179
+ signing_key:
180
+ specification_version: 4
181
+ summary: A fancy command line runner that lets you tell the terminal in words what
182
+ to do.
183
+ test_files: []