snippet_cli 0.3.6 → 0.5.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.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +29 -15
  3. data/exe/snippet_cli +45 -11
  4. data/lib/snippet_cli/Espanso_Merged_Matchfile_Schema.json +889 -0
  5. data/lib/snippet_cli/banner.rb +16 -0
  6. data/lib/snippet_cli/commands/check.rb +49 -0
  7. data/lib/snippet_cli/commands/conflict.rb +75 -0
  8. data/lib/snippet_cli/commands/new.rb +16 -102
  9. data/lib/snippet_cli/commands/vars.rb +58 -0
  10. data/lib/snippet_cli/commands/version.rb +17 -0
  11. data/lib/snippet_cli/conflict_detector.rb +71 -0
  12. data/lib/snippet_cli/cursor_helper.rb +20 -0
  13. data/lib/snippet_cli/espanso_config.rb +26 -0
  14. data/lib/snippet_cli/file_helper.rb +16 -0
  15. data/lib/snippet_cli/file_validator.rb +33 -0
  16. data/lib/snippet_cli/file_writer.rb +12 -0
  17. data/lib/snippet_cli/form_field_parser.rb +13 -0
  18. data/lib/snippet_cli/global_vars_formatter.rb +63 -0
  19. data/lib/snippet_cli/global_vars_writer.rb +29 -0
  20. data/lib/snippet_cli/gum_theme.rb +39 -0
  21. data/lib/snippet_cli/hash_utils.rb +21 -0
  22. data/lib/snippet_cli/match_file_writer.rb +26 -0
  23. data/lib/snippet_cli/match_validator.rb +33 -0
  24. data/lib/snippet_cli/new_workflow.rb +98 -0
  25. data/lib/snippet_cli/replacement_text_collector.rb +55 -0
  26. data/lib/snippet_cli/replacement_validator.rb +35 -0
  27. data/lib/snippet_cli/replacement_wizard.rb +100 -0
  28. data/lib/snippet_cli/schema_validator.rb +27 -0
  29. data/lib/snippet_cli/snippet_builder.rb +133 -0
  30. data/lib/snippet_cli/string_helper.rb +11 -0
  31. data/lib/snippet_cli/table_formatter.rb +37 -0
  32. data/lib/snippet_cli/trigger_resolver.rb +67 -0
  33. data/lib/snippet_cli/ui.rb +90 -0
  34. data/lib/snippet_cli/var_builder/form_fields.rb +54 -0
  35. data/lib/snippet_cli/var_builder/name_collector.rb +69 -0
  36. data/lib/snippet_cli/var_builder/param_schema.rb +71 -0
  37. data/lib/snippet_cli/var_builder/params.rb +127 -0
  38. data/lib/snippet_cli/var_builder.rb +125 -0
  39. data/lib/snippet_cli/var_summary_renderer.rb +48 -0
  40. data/lib/snippet_cli/var_usage_checker.rb +48 -0
  41. data/lib/snippet_cli/var_yaml_renderer.rb +20 -0
  42. data/lib/snippet_cli/vars_block_renderer.rb +15 -0
  43. data/lib/snippet_cli/version.rb +3 -1
  44. data/lib/snippet_cli/wizard_context.rb +13 -0
  45. data/lib/snippet_cli/wizard_helpers/error_handler.rb +20 -0
  46. data/lib/snippet_cli/wizard_helpers/match_file_selector.rb +32 -0
  47. data/lib/snippet_cli/wizard_helpers/prompt_helpers.rb +57 -0
  48. data/lib/snippet_cli/wizard_helpers/validation_loop.rb +33 -0
  49. data/lib/snippet_cli/wizard_helpers.rb +8 -0
  50. data/lib/snippet_cli/yaml_line_resolver.rb +46 -0
  51. data/lib/snippet_cli/yaml_loader.rb +19 -0
  52. data/lib/snippet_cli/yaml_param_renderer.rb +33 -0
  53. data/lib/snippet_cli/yaml_scalar.rb +48 -0
  54. data/lib/snippet_cli.rb +44 -1
  55. metadata +134 -101
  56. data/.gitignore +0 -11
  57. data/.rspec +0 -3
  58. data/.travis.yml +0 -9
  59. data/CODE_OF_CONDUCT.md +0 -74
  60. data/Gemfile +0 -17
  61. data/Rakefile +0 -10
  62. data/bin/console +0 -14
  63. data/bin/setup +0 -8
  64. data/lib/Setup.rb +0 -76
  65. data/lib/banner.rb +0 -16
  66. data/lib/snippet_cli/cli.rb +0 -62
  67. data/lib/snippet_cli/command.rb +0 -121
  68. data/lib/snippet_cli/commands/info.md +0 -20
  69. data/lib/snippet_cli/commands/info.rb +0 -36
  70. data/lib/snippet_cli/commands/setup.rb +0 -108
  71. data/lib/snippet_cli/templates/.gitkeep +0 -1
  72. data/lib/snippet_cli/templates/config/.gitkeep +0 -1
  73. data/lib/snippet_cli/templates/create/.gitkeep +0 -1
  74. data/lib/snippet_cli/templates/info/.gitkeep +0 -1
  75. data/lib/snippet_cli/templates/setup/.gitkeep +0 -1
  76. data/lib/snippet_generator.rb +0 -85
  77. data/snippet_cli-0.1.0.gem +0 -0
  78. data/snippet_cli-0.1.1.gem +0 -0
  79. data/snippet_cli-0.1.2.gem +0 -0
  80. data/snippet_cli-0.1.3.gem +0 -0
  81. data/snippet_cli-0.1.4.gem +0 -0
  82. data/snippet_cli-0.1.5.gem +0 -0
  83. data/snippet_cli-0.1.6.gem +0 -0
  84. data/snippet_cli-0.1.7.gem +0 -0
  85. data/snippet_cli-0.1.8.gem +0 -0
  86. data/snippet_cli-0.1.9.gem +0 -0
  87. data/snippet_cli-0.2.0.gem +0 -0
  88. data/snippet_cli-0.2.1.gem +0 -0
  89. data/snippet_cli-0.2.2.gem +0 -0
  90. data/snippet_cli-0.2.3.gem +0 -0
  91. data/snippet_cli-0.2.4.gem +0 -0
  92. data/snippet_cli-0.2.6.gem +0 -0
  93. data/snippet_cli-0.2.7.gem +0 -0
  94. data/snippet_cli-0.2.8.gem +0 -0
  95. data/snippet_cli.gemspec +0 -37
metadata CHANGED
@@ -1,142 +1,169 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snippet_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - AJ Markow
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2021-11-11 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
- name: tty-prompt
13
+ name: dry-cli
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
18
+ version: '1.0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ">="
23
+ - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0'
25
+ version: '1.0'
27
26
  - !ruby/object:Gem::Dependency
28
- name: tty-box
27
+ name: gum
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
- - - ">="
30
+ - - "~>"
32
31
  - !ruby/object:Gem::Version
33
- version: '0'
32
+ version: '0.3'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
- - - ">="
37
+ - - "~>"
39
38
  - !ruby/object:Gem::Version
40
- version: '0'
39
+ version: '0.3'
41
40
  - !ruby/object:Gem::Dependency
42
- name: tty-platform
41
+ name: json_schemer
43
42
  requirement: !ruby/object:Gem::Requirement
44
43
  requirements:
45
- - - ">="
44
+ - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: '0'
46
+ version: '2.0'
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
- - - ">="
51
+ - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '0'
53
+ version: '2.0'
55
54
  - !ruby/object:Gem::Dependency
56
- name: tty-markdown
55
+ name: tty-cursor
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
- - - ">="
58
+ - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '0'
60
+ version: '0.7'
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
- - - ">="
65
+ - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: '0'
67
+ version: '0.7'
69
68
  - !ruby/object:Gem::Dependency
70
- name: pastel
69
+ name: aruba
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
- - - ">="
72
+ - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :runtime
74
+ version: '2.0'
75
+ type: :development
77
76
  prerelease: false
78
77
  version_requirements: !ruby/object:Gem::Requirement
79
78
  requirements:
80
- - - ">="
79
+ - - "~>"
81
80
  - !ruby/object:Gem::Version
82
- version: '0'
81
+ version: '2.0'
83
82
  - !ruby/object:Gem::Dependency
84
- name: bundler
83
+ name: bundler-audit
85
84
  requirement: !ruby/object:Gem::Requirement
86
85
  requirements:
87
- - - ">="
86
+ - - "~>"
88
87
  - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :runtime
88
+ version: '0.9'
89
+ type: :development
91
90
  prerelease: false
92
91
  version_requirements: !ruby/object:Gem::Requirement
93
92
  requirements:
94
- - - ">="
93
+ - - "~>"
95
94
  - !ruby/object:Gem::Version
96
- version: '0'
95
+ version: '0.9'
97
96
  - !ruby/object:Gem::Dependency
98
- name: snippets_for_espanso
97
+ name: rake
99
98
  requirement: !ruby/object:Gem::Requirement
100
99
  requirements:
101
- - - ">="
100
+ - - "~>"
102
101
  - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :runtime
102
+ version: '13.0'
103
+ type: :development
105
104
  prerelease: false
106
105
  version_requirements: !ruby/object:Gem::Requirement
107
106
  requirements:
108
- - - ">="
107
+ - - "~>"
109
108
  - !ruby/object:Gem::Version
110
- version: '0'
109
+ version: '13.0'
111
110
  - !ruby/object:Gem::Dependency
112
- name: httparty
111
+ name: rspec
113
112
  requirement: !ruby/object:Gem::Requirement
114
113
  requirements:
115
- - - ">="
114
+ - - "~>"
116
115
  - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :runtime
116
+ version: '3.0'
117
+ type: :development
119
118
  prerelease: false
120
119
  version_requirements: !ruby/object:Gem::Requirement
121
120
  requirements:
122
- - - ">="
121
+ - - "~>"
123
122
  - !ruby/object:Gem::Version
124
- version: '0'
123
+ version: '3.0'
125
124
  - !ruby/object:Gem::Dependency
126
- name: ascii
125
+ name: rubocop
127
126
  requirement: !ruby/object:Gem::Requirement
128
127
  requirements:
129
- - - ">="
128
+ - - "~>"
130
129
  - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :runtime
130
+ version: '1.0'
131
+ type: :development
132
+ prerelease: false
133
+ version_requirements: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - "~>"
136
+ - !ruby/object:Gem::Version
137
+ version: '1.0'
138
+ - !ruby/object:Gem::Dependency
139
+ name: ruby-lsp
140
+ requirement: !ruby/object:Gem::Requirement
141
+ requirements:
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '0.23'
145
+ type: :development
146
+ prerelease: false
147
+ version_requirements: !ruby/object:Gem::Requirement
148
+ requirements:
149
+ - - "~>"
150
+ - !ruby/object:Gem::Version
151
+ version: '0.23'
152
+ - !ruby/object:Gem::Dependency
153
+ name: simplecov
154
+ requirement: !ruby/object:Gem::Requirement
155
+ requirements:
156
+ - - "~>"
157
+ - !ruby/object:Gem::Version
158
+ version: 0.21.2
159
+ type: :development
133
160
  prerelease: false
134
161
  version_requirements: !ruby/object:Gem::Requirement
135
162
  requirements:
136
- - - ">="
163
+ - - "~>"
137
164
  - !ruby/object:Gem::Version
138
- version: '0'
139
- description: You can write to your espanso config directly using this gem
165
+ version: 0.21.2
166
+ description: A tool to build complex Espanso snippets interactively
140
167
  email:
141
168
  - alexanderjmarkow@gmail.com
142
169
  executables:
@@ -144,61 +171,69 @@ executables:
144
171
  extensions: []
145
172
  extra_rdoc_files: []
146
173
  files:
147
- - ".gitignore"
148
- - ".rspec"
149
- - ".travis.yml"
150
- - CODE_OF_CONDUCT.md
151
- - Gemfile
152
174
  - LICENSE.txt
153
175
  - README.md
154
- - Rakefile
155
- - bin/console
156
- - bin/setup
157
176
  - exe/snippet_cli
158
- - lib/Setup.rb
159
- - lib/banner.rb
160
177
  - lib/snippet_cli.rb
161
- - lib/snippet_cli/cli.rb
162
- - lib/snippet_cli/command.rb
178
+ - lib/snippet_cli/Espanso_Merged_Matchfile_Schema.json
179
+ - lib/snippet_cli/banner.rb
163
180
  - lib/snippet_cli/commands/.gitkeep
164
- - lib/snippet_cli/commands/info.md
165
- - lib/snippet_cli/commands/info.rb
181
+ - lib/snippet_cli/commands/check.rb
182
+ - lib/snippet_cli/commands/conflict.rb
166
183
  - lib/snippet_cli/commands/new.rb
167
- - lib/snippet_cli/commands/setup.rb
168
- - lib/snippet_cli/templates/.gitkeep
169
- - lib/snippet_cli/templates/config/.gitkeep
170
- - lib/snippet_cli/templates/create/.gitkeep
171
- - lib/snippet_cli/templates/info/.gitkeep
172
- - lib/snippet_cli/templates/setup/.gitkeep
184
+ - lib/snippet_cli/commands/vars.rb
185
+ - lib/snippet_cli/commands/version.rb
186
+ - lib/snippet_cli/conflict_detector.rb
187
+ - lib/snippet_cli/cursor_helper.rb
188
+ - lib/snippet_cli/espanso_config.rb
189
+ - lib/snippet_cli/file_helper.rb
190
+ - lib/snippet_cli/file_validator.rb
191
+ - lib/snippet_cli/file_writer.rb
192
+ - lib/snippet_cli/form_field_parser.rb
193
+ - lib/snippet_cli/global_vars_formatter.rb
194
+ - lib/snippet_cli/global_vars_writer.rb
195
+ - lib/snippet_cli/gum_theme.rb
196
+ - lib/snippet_cli/hash_utils.rb
197
+ - lib/snippet_cli/match_file_writer.rb
198
+ - lib/snippet_cli/match_validator.rb
199
+ - lib/snippet_cli/new_workflow.rb
200
+ - lib/snippet_cli/replacement_text_collector.rb
201
+ - lib/snippet_cli/replacement_validator.rb
202
+ - lib/snippet_cli/replacement_wizard.rb
203
+ - lib/snippet_cli/schema_validator.rb
204
+ - lib/snippet_cli/snippet_builder.rb
205
+ - lib/snippet_cli/string_helper.rb
206
+ - lib/snippet_cli/table_formatter.rb
207
+ - lib/snippet_cli/trigger_resolver.rb
208
+ - lib/snippet_cli/ui.rb
209
+ - lib/snippet_cli/var_builder.rb
210
+ - lib/snippet_cli/var_builder/form_fields.rb
211
+ - lib/snippet_cli/var_builder/name_collector.rb
212
+ - lib/snippet_cli/var_builder/param_schema.rb
213
+ - lib/snippet_cli/var_builder/params.rb
214
+ - lib/snippet_cli/var_summary_renderer.rb
215
+ - lib/snippet_cli/var_usage_checker.rb
216
+ - lib/snippet_cli/var_yaml_renderer.rb
217
+ - lib/snippet_cli/vars_block_renderer.rb
173
218
  - lib/snippet_cli/version.rb
174
- - lib/snippet_generator.rb
175
- - snippet_cli-0.1.0.gem
176
- - snippet_cli-0.1.1.gem
177
- - snippet_cli-0.1.2.gem
178
- - snippet_cli-0.1.3.gem
179
- - snippet_cli-0.1.4.gem
180
- - snippet_cli-0.1.5.gem
181
- - snippet_cli-0.1.6.gem
182
- - snippet_cli-0.1.7.gem
183
- - snippet_cli-0.1.8.gem
184
- - snippet_cli-0.1.9.gem
185
- - snippet_cli-0.2.0.gem
186
- - snippet_cli-0.2.1.gem
187
- - snippet_cli-0.2.2.gem
188
- - snippet_cli-0.2.3.gem
189
- - snippet_cli-0.2.4.gem
190
- - snippet_cli-0.2.6.gem
191
- - snippet_cli-0.2.7.gem
192
- - snippet_cli-0.2.8.gem
193
- - snippet_cli.gemspec
219
+ - lib/snippet_cli/wizard_context.rb
220
+ - lib/snippet_cli/wizard_helpers.rb
221
+ - lib/snippet_cli/wizard_helpers/error_handler.rb
222
+ - lib/snippet_cli/wizard_helpers/match_file_selector.rb
223
+ - lib/snippet_cli/wizard_helpers/prompt_helpers.rb
224
+ - lib/snippet_cli/wizard_helpers/validation_loop.rb
225
+ - lib/snippet_cli/yaml_line_resolver.rb
226
+ - lib/snippet_cli/yaml_loader.rb
227
+ - lib/snippet_cli/yaml_param_renderer.rb
228
+ - lib/snippet_cli/yaml_scalar.rb
194
229
  homepage: https://github.com/ajmarkow/snippet_cli
195
230
  licenses:
196
231
  - MIT
197
232
  metadata:
198
233
  homepage_uri: https://github.com/ajmarkow/snippet_cli
199
234
  source_code_uri: https://github.com/ajmarkow/snippet_cli
200
- changelog_uri: https://github.com/ajmarkow/snippet_cli
201
- post_install_message:
235
+ changelog_uri: https://github.com/ajmarkow/snippet_cli/blob/master/CHANGELOG.md
236
+ github_repo: ssh://github.com/ajmarkow/snippet_cli
202
237
  rdoc_options: []
203
238
  require_paths:
204
239
  - lib
@@ -206,16 +241,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
206
241
  requirements:
207
242
  - - ">="
208
243
  - !ruby/object:Gem::Version
209
- version: 2.3.0
244
+ version: 3.1.0
210
245
  required_rubygems_version: !ruby/object:Gem::Requirement
211
246
  requirements:
212
247
  - - ">="
213
248
  - !ruby/object:Gem::Version
214
249
  version: '0'
215
250
  requirements: []
216
- rubyforge_project:
217
- rubygems_version: 2.7.6.2
218
- signing_key:
251
+ rubygems_version: 3.6.9
219
252
  specification_version: 4
220
- summary: Allows you to add snippets to Espanso Config from CLI
253
+ summary: Interactively build snippets for Espanso
221
254
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.travis.yml DELETED
@@ -1,9 +0,0 @@
1
- os:
2
- - linux
3
- - osx
4
- - windows
5
- language: ruby
6
- cache: bundler
7
- rvm:
8
- - 2.6.6
9
- before_install: gem install bundler -v 2.1.4
data/CODE_OF_CONDUCT.md DELETED
@@ -1,74 +0,0 @@
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 alexanderjmarkow@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 [https://contributor-covenant.org/version/1/4][version]
72
-
73
- [homepage]: https://contributor-covenant.org
74
- [version]: https://contributor-covenant.org/version/1/4/
data/Gemfile DELETED
@@ -1,17 +0,0 @@
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/Rakefile DELETED
@@ -1,10 +0,0 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
7
-
8
- task :spec do
9
- sh 'rspec spec'
10
- end
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "snippet_cli"
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 DELETED
@@ -1,8 +0,0 @@
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/lib/Setup.rb DELETED
@@ -1,76 +0,0 @@
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
- FileUtils.cd("#{ENV["HOME"]}")
69
- FileUtils.touch("#{ENV["HOME"]}\\snippet_cli_config.txt")
70
- File.open("#{ENV["HOME"]}\\snippet_cli_config.txt", "w") { |f| f.write "NAME = #{self.user_name}\n"}
71
- File.open("#{ENV["HOME"]}\\snippet_cli_config.txt", "w") { |f| f.write "OS = #{self.user_os}\n"}
72
- File.open("#{ENV["HOME"]}\\snippet_cli_config.txt", "w") { |f| f.write "STORAGE = #{self.user_storage}\n"}
73
- File.open("#{ENV["HOME"]}\\snippet_cli_config.txt", "w") { |f| f.write "CONFIG_PRESENT = TRUE\n"}
74
- end
75
- end
76
- end
data/lib/banner.rb DELETED
@@ -1,16 +0,0 @@
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
- end
@@ -1,62 +0,0 @@
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