snippet_cli 0.2.3 → 0.3.2

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: ef970184ca46c2d009feb5b35a23cf83b258a63aee81e1b3a61259ae2c7b0ccf
4
- data.tar.gz: 06f97fc1903a6eaed6c8280d04db9e46d588818916dee30cbf600eb4c786cc73
3
+ metadata.gz: 657486002bc2d360c27c7c99aef89444bc0568cbfbb9014b31320b45e327d658
4
+ data.tar.gz: '087e66f9b9da46283e6caa6bb5559c34db1c1dc239161f6fccce2859bfa17301'
5
5
  SHA512:
6
- metadata.gz: 4d13812aa194e42b1f185d890212825b99f58f135eaa632cd989f29e2bb24e537e0fae8b1b73607756b5da1802550788919856e94241f7c6792166a832ecc708
7
- data.tar.gz: d3f1c06832065c52e40b2d96503e2447f3d2112660c79a33e44ecbeee557afd8387fa870f0a7b15d8f0938e84f595cdf1aa46080c2ec806d4dffd38468f6f346
6
+ metadata.gz: 549e67aa41e8f8c6d07ffd943b9ce872fa3a7890c6e2b1735b5e50c1ca2c9217db366c7e54bc11c6b7bc63029efa73d8fb6facc26ee65f840b64c2437b6448ab
7
+ data.tar.gz: 2628d10518b17461f00b05a045e95f8334ab0d65e408d4c1dd457f65a83808180e5918e685828979fdc4dddb3dcd03684cc073453e4d2b08f99a63dfe5fb8693
data/.travis.yml CHANGED
@@ -1,4 +1,7 @@
1
- ---
1
+ os:
2
+ - linux
3
+ - osx
4
+ - windows
2
5
  language: ruby
3
6
  cache: bundler
4
7
  rvm:
data/Gemfile CHANGED
@@ -1,16 +1,17 @@
1
- source "https://rubygems.org"
2
-
3
- # Specify your gem's dependencies in snippet_cli.gemspec
4
- gemspec
5
-
6
- gem "rake", "~> 12.0"
7
- gem "rspec", "~> 3.0"
8
- gem "tty-prompt"
9
- gem "tty-box"
10
- gem "tty-platform"
11
- gem 'tty-markdown'
12
- gem "pastel"
13
- gem "bundler"
14
- gem "snippets_for_espanso"
15
- gem "httparty"
16
- gem "ascii"
1
+ source "https://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in snippet_cli.gemspec
4
+ gemspec
5
+
6
+ gem "rake"
7
+ gem "rspec", "~> 3.0"
8
+ gem "tty-prompt"
9
+ gem "tty-box"
10
+ gem "tty-platform"
11
+ gem 'tty-markdown'
12
+ gem "pastel"
13
+ gem "bundler"
14
+ gem "snippets_for_espanso"
15
+ gem "httparty"
16
+ gem "ascii"
17
+ gem "thor"
data/README.md CHANGED
@@ -1,44 +1,43 @@
1
- # SnippetCli
2
-
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/snippet_cli`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
6
-
7
- ## Installation
8
-
9
- Add this line to your application's Gemfile:
10
-
11
- ```ruby
12
- gem 'snippet_cli'
13
- ```
14
-
15
- And then execute:
16
-
17
- $ bundle install
18
-
19
- Or install it yourself as:
20
-
21
- $ gem install snippet_cli
22
-
23
- ## Usage
24
-
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- 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.
30
-
31
- 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).
32
-
33
- ## Contributing
34
-
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/snippet_cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/snippet_cli/blob/master/CODE_OF_CONDUCT.md).
36
-
37
-
38
- ## Code of Conduct
39
-
40
- Everyone interacting in the SnippetCli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/snippet_cli/blob/master/CODE_OF_CONDUCT.md).
41
-
42
- ## Copyright
43
-
44
- Copyright (c) 2020 AJ Markow. See [MIT License](LICENSE.txt) for further details.
1
+ # SnippetCli
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/snippet_cli`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'snippet_cli'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle install
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install snippet_cli
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ 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.
30
+
31
+ 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 new a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/snippet_cli. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/snippet_cli/blob/master/CODE_OF_CONDUCT.md).
36
+
37
+ ## Code of Conduct
38
+
39
+ Everyone interacting in the SnippetCli project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/snippet_cli/blob/master/CODE_OF_CONDUCT.md).
40
+
41
+ ## Copyright
42
+
43
+ Copyright (c) 2020 AJ Markow. See [MIT License](LICENSE.txt) for further details.
data/Rakefile CHANGED
@@ -4,3 +4,7 @@ require "rspec/core/rake_task"
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
6
  task :default => :spec
7
+
8
+ task :spec do
9
+ sh 'rspec spec'
10
+ end
data/exe/snippet_cli CHANGED
File without changes
data/lib/Setup.rb CHANGED
@@ -1,74 +1,74 @@
1
- require 'tty/prompt'
2
- require 'tty/box'
3
- prompt = TTY::Prompt.new
4
-
5
-
6
- class Setup
7
- @leading = " "
8
- @divider = "------------------------------------"
9
- attr_accessor :user_name,:user_os,:user_storage,:config_present
10
-
11
- def initialize(user_name,user_os,user_storage,config_present)
12
- @user_name = user_name
13
- @user_os = user_os
14
- @user_storage = user_storage
15
- @config_present = config_present
16
- end
17
-
18
- class Error < StandardError; end
19
-
20
-
21
- def get_name()
22
- puts @leading
23
- prompt = TTY::Prompt.new
24
- name = prompt.ask("To begin setup, may I have your name?", default: ENV["USER"], active_color: :bright_blue) do |q|
25
- q.required true
26
- end
27
- puts @leading
28
- self.user_name = name
29
- end
30
-
31
- def get_os()
32
- puts @leading
33
- prompt = TTY::Prompt.new
34
- config_path = prompt.ask("What OS are you using?", default: ENV["OS"], active_color: :bright_blue) do |q|
35
- q.required true
36
- end
37
- if (config_path.include? "Windows")
38
- return config_path = "\\Roaming\\AppData\\espanso\\default.yml"
39
- elsif (config_path.include?"OS X")
40
- return config_path = "#{ENV["HOME"]}/Library/Preferences/espanso/default.yml"
41
- else config_path.include?("Linux")
42
- return config_path = "#{ENV["HOME"]}/.config/espanso/default.yml"
43
- end
44
- puts @leading
45
- self.user_os=config_path
46
- end
47
-
48
- # REFACTOR TO PROVIDE PATH
49
- def get_storage()
50
- puts @leading
51
- prompt = TTY::Prompt.new
52
- return snippet_storage = prompt.select("Do your store your snippets in Dropbox or a different directory?", default: 1, active_color: :bright_blue) do |menu|
53
- menu.enum "."
54
-
55
- menu.choice "No I use the default folder.", 1
56
- menu.choice "I use Dropbox.", 2
57
- menu.choice "I use Google Drive", 3
58
- menu.choice "I use Another Directory.", 4
59
- end
60
- puts @leading
61
- self.user_storage = snippet_storage
62
- end
63
-
64
- def generate_config()
65
- if File.exist?("#{ENV["HOME"]}/snippet_cli_config.txt") then
66
-
67
- else
68
- File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "NAME = #{self.user_name}\n"}
69
- File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "OS = #{self.user_os}\n"}
70
- File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "STORAGE = #{self.user_storage}\n"}
71
- File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "CONFIG_PRESENT = TRUE\n"}
72
- end
73
- end
1
+ require 'tty-prompt'
2
+ require 'tty-box'
3
+ prompt = TTY::Prompt.new
4
+
5
+
6
+ class Setup
7
+ @leading = " "
8
+ @divider = "------------------------------------"
9
+ attr_accessor :user_name,:user_os,:user_storage,:config_present
10
+
11
+ def initialize(user_name,user_os,user_storage,config_present)
12
+ @user_name = user_name
13
+ @user_os = user_os
14
+ @user_storage = user_storage
15
+ @config_present = config_present
16
+ end
17
+
18
+ class Error < StandardError; end
19
+
20
+
21
+ def get_name()
22
+ puts @leading
23
+ prompt = TTY::Prompt.new
24
+ name = prompt.ask("To begin setup, may I have your name?", default: ENV["USER"], active_color: :bright_blue) do |q|
25
+ q.required true
26
+ end
27
+ puts @leading
28
+ self.user_name = name
29
+ end
30
+
31
+ def get_os()
32
+ puts @leading
33
+ prompt = TTY::Prompt.new
34
+ config_path = prompt.ask("What OS are you using?", default: ENV["OS"], active_color: :bright_blue) do |q|
35
+ q.required true
36
+ end
37
+ if (config_path.include? "Windows")
38
+ return config_path = "\\Roaming\\AppData\\espanso\\default.yml"
39
+ elsif (config_path.include?"OS X")
40
+ return config_path = "#{ENV["HOME"]}/Library/Preferences/espanso/default.yml"
41
+ else config_path.include?("Linux")
42
+ return config_path = "#{ENV["HOME"]}/.config/espanso/default.yml"
43
+ end
44
+ puts @leading
45
+ self.user_os=config_path
46
+ end
47
+
48
+ # REFACTOR TO PROVIDE PATH
49
+ def get_storage()
50
+ puts @leading
51
+ prompt = TTY::Prompt.new
52
+ return snippet_storage = prompt.select("Do your store your snippets in Dropbox or a different directory?", default: 1, active_color: :bright_blue) do |menu|
53
+ menu.enum "."
54
+
55
+ menu.choice "No I use the default folder.", 1
56
+ menu.choice "I use Dropbox.", 2
57
+ menu.choice "I use Google Drive", 3
58
+ menu.choice "I use Another Directory.", 4
59
+ end
60
+ puts @leading
61
+ self.user_storage = snippet_storage
62
+ end
63
+
64
+ def generate_config()
65
+ if File.exist?("#{ENV["HOME"]}/snippet_cli_config.txt") then
66
+
67
+ else
68
+ File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "NAME = #{self.user_name}\n"}
69
+ File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "OS = #{self.user_os}\n"}
70
+ File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "STORAGE = #{self.user_storage}\n"}
71
+ File.open("#{ENV["HOME"]}/snippet_cli_config.txt", "a") { |f| f.write "CONFIG_PRESENT = TRUE\n"}
72
+ end
73
+ end
74
74
  end
data/lib/banner.rb CHANGED
@@ -1,16 +1,16 @@
1
- require 'tty-box'
2
-
3
- def show_banner()
4
- box = TTY::Box::frame(width:67, height:11, border: :thick, align: :left) do
5
- "
6
- ##### # # ### ###### ###### ####### #######
7
- # # ## # # # # # # # #
8
- # # # # # # # # # # #
9
- ##### # # # # ###### ###### ##### #
10
- # # # # # # # # #
11
- # # # ## # # # # #
12
- ##### # # ### # # ####### # CLI
13
- "
14
- end
15
- puts box
1
+ require 'tty-box'
2
+
3
+ def show_banner()
4
+ box = TTY::Box::frame(width:67, height:11, border: :thick, align: :left) do
5
+ "
6
+ ##### # # ### ###### ###### ####### #######
7
+ # # ## # # # # # # # #
8
+ # # # # # # # # # # #
9
+ ##### # # # # ###### ###### ##### #
10
+ # # # # # # # # #
11
+ # # # ## # # # # #
12
+ ##### # # ### # # ####### # CLI
13
+ "
14
+ end
15
+ puts box
16
16
  end
@@ -1,58 +1,62 @@
1
- # frozen_string_literal: true
2
-
3
- require 'thor'
4
-
5
- module SnippetCli
6
- # Handle the application command line parsing
7
- # and the dispatch to various command objects
8
- #
9
- # @api public
10
- class CLI < Thor
11
- # Error raised by this runner
12
- Error = Class.new(StandardError)
13
-
14
- desc 'version', 'snippet_cli version'
15
- def version
16
- require_relative 'version'
17
- puts "v#{SnippetCli::VERSION}"
18
- end
19
- map %w(--version -v) => :version
20
-
21
- desc 'info [DOCS]', 'Show info and docs about using the program.'
22
- method_option :help, aliases: '-h', type: :boolean,
23
- desc: 'Display usage information'
24
- def info(docs = nil)
25
- if options[:help]
26
- invoke :help, ['info']
27
- else
28
- require_relative 'commands/info'
29
- SnippetCli::Commands::Info.new(docs, options).execute
30
- end
31
- end
32
-
33
- desc 'new', 'Guides you through adding a new snippet.'
34
- method_option :help, aliases: '-h', type: :boolean,
35
- desc: 'Display usage information'
36
- def new(*)
37
- if options[:help]
38
- invoke :help, ['new']
39
- else
40
- require_relative 'commands/new'
41
- SnippetCli::Commands::New.new(options).execute
42
- end
43
- end
44
-
45
- desc 'setup', 'Sets up snippet_cli to modify correct.'
46
- method_option :help, aliases: '-h', type: :boolean,
47
- desc: 'Set directory to write to snippet file in'
48
- def setup(*)
49
- if options[:help]
50
- invoke :help, ['setup']
51
- else
52
- require_relative 'commands/setup'
53
- SnippetCli::Commands::Setup.new().execute
54
- end
55
- end
56
-
57
- end
58
- end
1
+ # frozen_string_literal: true
2
+
3
+ require 'thor'
4
+
5
+ module SnippetCli
6
+ # Handle the application command line parsing
7
+ # and the dispatch to various command objects
8
+ #
9
+ # @api public
10
+ class CLI < Thor
11
+ def self.exit_on_failure?
12
+ true
13
+ puts "Something went wrong, try again."
14
+ end
15
+ # Error raised by this runner
16
+ Error = Class.new(StandardError)
17
+
18
+ desc 'version', 'snippet_cli version'
19
+ def version
20
+ require_relative 'version'
21
+ puts "v#{SnippetCli::VERSION}"
22
+ end
23
+ map %w(--version -v) => :version
24
+
25
+ desc 'info [DOCS]', 'Show info and docs about using the program.'
26
+ method_option :help, aliases: '-h', type: :boolean,
27
+ desc: 'Shows you where you can find more documentation and leave feedback for the program.'
28
+ def info(docs = nil)
29
+ if options[:help]
30
+ invoke :help, ['info']
31
+ else
32
+ require_relative 'commands/info'
33
+ SnippetCli::Commands::Info.new(docs, options).execute
34
+ end
35
+ end
36
+
37
+ desc 'new', 'Guides you through adding a new snippet.'
38
+ method_option :help, aliases: '-h', type: :boolean,
39
+ desc: 'Adds a new snippet to your yml file.'
40
+ def new(*)
41
+ if options[:help]
42
+ invoke :help, ['new']
43
+ else
44
+ require_relative 'commands/new'
45
+ SnippetCli::Commands::New.new(options).execute
46
+ end
47
+ end
48
+
49
+ desc 'setup', 'Sets up snippet_cli to modify correct file.'
50
+ method_option :help, aliases: '-h', type: :boolean,
51
+ desc: 'Sets directory to write to snippet file in.'
52
+ def setup(*)
53
+ if options[:help]
54
+ invoke :help, ['setup']
55
+ else
56
+ require_relative 'commands/setup'
57
+ SnippetCli::Commands::Setup.new().execute
58
+ end
59
+ end
60
+
61
+ end
62
+ end
@@ -1,20 +1,20 @@
1
- # Thanks for trying Snippet CLI!
2
-
3
- Hi! Have any feedback?
4
- We'd love to hear it.
5
- Click the link below to send an email to the developer.
6
-
7
- ## Links
8
-
9
- - [Install Espanso](https://espanso.org/)
10
- - [Snippet CLI Github](https://www.github.com/ajmarkow/snippet_cli)
11
- - [Snippet CLI Docs](https:/docs.snippetcli.com)
12
- - [Email Me Feedback](mailto:aj@ajm.codes)
13
-
14
- ## Commands
15
-
16
- | **Command** | **Purpose** |
17
- |----------|:------------------:|
18
- | setup | Sets up path to snippet file |
19
- | new | Opens dialog to add new snippet or form. |
1
+ # Thanks for trying Snippet CLI!
2
+
3
+ Hi! Have any feedback?
4
+ We'd love to hear it.
5
+ Click the link below to send an email to the developer.
6
+
7
+ ## Links
8
+
9
+ - [Install Espanso](https://espanso.org/)
10
+ - [Snippet CLI Github](https://www.github.com/ajmarkow/snippet_cli)
11
+ - [Snippet CLI Docs](https:/docs.snippetcli.com)
12
+ - [Email Me Feedback](mailto:aj@ajm.codes)
13
+
14
+ ## Commands
15
+
16
+ | **Command** | **Purpose** |
17
+ |----------|:------------------:|
18
+ | setup | Sets up path to snippet file |
19
+ | new | Opens dialog to add new snippet or form. |
20
20
  | info| Docs, Contact Info, and Resources |
@@ -13,7 +13,7 @@ module SnippetCli
13
13
  end
14
14
 
15
15
  def execute(input: $stdin, output: $stdout)
16
- def show_banner()
16
+ def show_banner()
17
17
  box = TTY::Box::frame(width:67, height:11, border: :thick, align: :left) do
18
18
  "
19
19
  ##### # # ### ###### ###### ####### #######
@@ -28,7 +28,7 @@ module SnippetCli
28
28
  puts box
29
29
  end
30
30
  puts show_banner()
31
- parsed_markdown=TTY::Markdown.parse_file('./lib/info.md')
31
+ parsed_markdown=TTY::Markdown.parse_file('/snippet_cli/commands/info.md')
32
32
  output.puts parsed_markdown
33
33
  end
34
34
  end