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.
@@ -1,113 +1,113 @@
1
- # frozen_string_literal: true
2
- require 'bundler/setup'
3
- require 'tty-box'
4
- require 'tty-prompt'
5
- require_relative '../../snippet_generator'
6
- require 'httparty'
7
- require 'json'
8
- require 'ascii'
9
- # require 'snippets_for_espanso/SnippetGenerator'
10
- require_relative '../command'
11
-
12
-
13
- module SnippetCli
14
- module Commands
15
- class New < SnippetCli::Command
16
- def show_banner()
17
- box = TTY::Box::frame(width:67, height:11, border: :thick, align: :left) do
18
- "
19
- ##### # # ### ###### ###### ####### #######
20
- # # ## # # # # # # # #
21
- # # # # # # # # # # #
22
- ##### # # # # ###### ###### ##### #
23
- # # # # # # # # #
24
- # # # ## # # # # #
25
- ##### # # ### # # ####### # CLI
26
- "
27
- end
28
- puts box
29
- end
30
- include SnippetGenerator
31
- @leading = " "
32
-
33
- prompt=TTY::Prompt.new
34
- def initialize(options)
35
- @options = options
36
- @file_path = File.readlines("#{ENV["HOME"]}/snippet_cli_config.txt")[1]
37
- @file_path = Ascii.process(@file_path)
38
- end
39
-
40
- def but_first()
41
- puts @leading
42
- puts "Now you'll enter what you want replaced."
43
- puts @leading
44
- puts "But first ..."
45
- puts @leading
46
- prompt.error("Don't use tabs. YAML hates them and it leads to unpredictable results.")
47
- puts @leading
48
- end
49
-
50
- def new_form()
51
- puts "Let's add a new snippet to your configuration"
52
- puts @leading
53
- snippet_type = prompt.select("Do you want a Snippet or a Snippet with a form?") do |menu|
54
- menu.enum "."
55
-
56
- menu.choice "A snippet",1
57
- menu.choice "A snippet with a form",2
58
- menu.choice "A snippet from Semplificato API",3
59
- end
60
- case snippet_type
61
- when 1
62
- puts @leading
63
- snippet_trigger=prompt.ask("What do you want to type to trigger the snippet?")
64
- puts @leading
65
- puts "Okay, the snippet will be triggered by:"
66
- prompt.ok( ":#{snippet_trigger}")
67
- puts@leading
68
- but_first()
69
- replacement = prompt.multiline("what did you want the trigger to be replaced with?")
70
- if (replacement.length() > 1)
71
- single_snippet_export(@file_path,snippet_trigger,replacement)
72
- else
73
- single_snippet_export(@file_path,snippet_trigger,replacement[0])
74
- end
75
- when 2
76
- puts @leading
77
- snippet_trigger=prompt.ask("What do you want to type to trigger the snippet?")
78
- puts @leading
79
- puts "Okay, the snippet will be triggered by:"
80
- prompt.ok( ":#{snippet_trigger}")
81
- puts@leading
82
- but_first()
83
- newprompt = TTY::Prompt.new
84
- newprompt.warn("For a form field wrap the word in double brackets. Like {{example}}")
85
- puts @leading
86
- newprompt.ok("Also make sure the name of each form field is unique.")
87
- puts @leading
88
- replacement = prompt.multiline("what did you want the trigger to be replaced with?")
89
- if (replacement.length() > 1)
90
- input_form_snippet_export(@file_path,snippet_trigger,replacement)
91
- else
92
- input_form_snippet_export(@file_path,snippet_trigger,replacement[0])
93
- end
94
- when 3
95
- puts @leading
96
- url = prompt.ask("What's the URL of the snippet?",default: "http://localhost:3000/snippets/1")
97
- json_url = url+(".json")
98
- api_response=HTTParty.get(json_url)
99
- response_parsed = api_response.body
100
- single_snippet_export(@file_path,response_parsed['trigger'],response_parsed['replacement'])
101
- puts@leading
102
- prompt.ok("Added snippet from #{url}")
103
- end
104
- end
105
-
106
- def execute(input: $stdin, output: $stdout)
107
- # Command logic goes here ...
108
- output.puts show_banner()
109
- new_form()
110
- end
111
- end
112
- end
113
- end
1
+ # frozen_string_literal: true
2
+ require 'bundler/setup'
3
+ require 'tty-box'
4
+ require 'tty-prompt'
5
+ require_relative '../../snippet_generator'
6
+ require 'httparty'
7
+ require 'json'
8
+ require 'ascii'
9
+ # require 'snippets_for_espanso/SnippetGenerator'
10
+ require_relative '../command'
11
+
12
+
13
+ module SnippetCli
14
+ module Commands
15
+ class New < SnippetCli::Command
16
+ def show_banner()
17
+ box = TTY::Box::frame(width:67, height:11, border: :thick, align: :left) do
18
+ "
19
+ ##### # # ### ###### ###### ####### #######
20
+ # # ## # # # # # # # #
21
+ # # # # # # # # # # #
22
+ ##### # # # # ###### ###### ##### #
23
+ # # # # # # # # #
24
+ # # # ## # # # # #
25
+ ##### # # ### # # ####### # CLI
26
+ "
27
+ end
28
+ puts box
29
+ end
30
+ include SnippetGenerator
31
+ @leading = " "
32
+
33
+ prompt=TTY::Prompt.new
34
+ def initialize(options)
35
+ @options = options
36
+ @file_path = File.readlines("#{ENV["HOME"]}/snippet_cli_config.txt")[1]
37
+ @file_path = Ascii.process(@file_path)
38
+ end
39
+
40
+ def but_first()
41
+ puts @leading
42
+ puts "Now you'll enter what you want replaced."
43
+ puts @leading
44
+ puts "But first ..."
45
+ puts @leading
46
+ prompt.error("Don't use tabs. YAML hates them and it leads to unpredictable results.")
47
+ puts @leading
48
+ end
49
+
50
+ def new_form()
51
+ puts "Let's add a new snippet to your configuration"
52
+ puts @leading
53
+ snippet_type = prompt.select("Do you want a Snippet or a Snippet with a form?") do |menu|
54
+ menu.enum "."
55
+
56
+ menu.choice "A snippet",1
57
+ menu.choice "A snippet with a form",2
58
+ menu.choice "A snippet from Semplificato API",3
59
+ end
60
+ case snippet_type
61
+ when 1
62
+ puts @leading
63
+ snippet_trigger=prompt.ask("What do you want to type to trigger the snippet?")
64
+ puts @leading
65
+ puts "Okay, the snippet will be triggered by:"
66
+ prompt.ok( ":#{snippet_trigger}")
67
+ puts@leading
68
+ but_first()
69
+ replacement = prompt.multiline("what did you want the trigger to be replaced with?")
70
+ if (replacement.length() > 1)
71
+ single_snippet_export(@file_path,snippet_trigger,replacement)
72
+ else
73
+ single_snippet_export(@file_path,snippet_trigger,replacement[0])
74
+ end
75
+ when 2
76
+ puts @leading
77
+ snippet_trigger=prompt.ask("What do you want to type to trigger the snippet?")
78
+ puts @leading
79
+ puts "Okay, the snippet will be triggered by:"
80
+ prompt.ok( ":#{snippet_trigger}")
81
+ puts@leading
82
+ but_first()
83
+ newprompt = TTY::Prompt.new
84
+ newprompt.warn("For a form field wrap the word in double brackets. Like {{example}}")
85
+ puts @leading
86
+ newprompt.ok("Also make sure the name of each form field is unique.")
87
+ puts @leading
88
+ replacement = prompt.multiline("what did you want the trigger to be replaced with?")
89
+ if (replacement.length() > 1)
90
+ input_form_snippet_export(@file_path,snippet_trigger,replacement)
91
+ else
92
+ input_form_snippet_export(@file_path,snippet_trigger,replacement[0])
93
+ end
94
+ when 3
95
+ puts @leading
96
+ url = prompt.ask("What's the URL of the snippet?",default: "http://localhost:3000/snippets/1")
97
+ json_url = url+(".json")
98
+ api_response=HTTParty.get(json_url)
99
+ response_parsed = api_response.body
100
+ single_snippet_export(@file_path,response_parsed['trigger'],response_parsed['replacement'])
101
+ puts@leading
102
+ prompt.ok("Added snippet from #{url}")
103
+ end
104
+ end
105
+
106
+ def execute(input: $stdin, output: $stdout)
107
+ # Command logic goes here ...
108
+ output.puts show_banner()
109
+ new_form()
110
+ end
111
+ end
112
+ end
113
+ end
@@ -1,108 +1,108 @@
1
- require_relative '../command'
2
- require 'bundler/setup'
3
- require 'tty-box'
4
- require 'tty-prompt'
5
- require 'tty-platform'
6
- # frozen_string_literal: true
7
-
8
-
9
- module SnippetCli
10
- module Commands
11
- class Setup < SnippetCli::Command
12
- platform= TTY::Platform.new
13
- @leading = " "
14
- attr_accessor :user_name,:config_path,:user_storage,:config_present,:os_choice
15
-
16
- def initialize()
17
- @user_name = user_name
18
- @config_path = config_path
19
- @user_storage = user_storage
20
- @os_choice = os_choice
21
- @config_present = config_present
22
- end
23
-
24
- def show_banner()
25
- box = TTY::Box::frame(width:67, height:11, border: :thick, align: :left) do
26
- "
27
- ##### # # ### ###### ###### ####### #######
28
- # # ## # # # # # # # #
29
- # # # # # # # # # # #
30
- ##### # # # # ###### ###### ##### #
31
- # # # # # # # # #
32
- # # # ## # # # # #
33
- ##### # # ### # # ####### # CLI
34
- "
35
- end
36
- puts box
37
- end
38
-
39
- def get_name()
40
- puts @leading
41
- prompt = TTY::Prompt.new
42
- name = prompt.ask("⟶ To begin setup, may I have your name?", default: ENV["USER"], active_color: :bright_blue) do |q|
43
- q.required true
44
- end
45
- puts @leading
46
- self.user_name = name
47
- end
48
-
49
- def get_os()
50
- puts @leading
51
- puts "Checking what os you're using..."
52
- os_choice = platform.os()
53
- if (platform.windows? == true)
54
- config_path = "#{ENV["HOMEPATH"]}\\AppData\\Roaming\\espanso\\default.yml"
55
- elsif (platform.mac? == true)
56
- config_path = "#{ENV["HOME"]}/Library/Preferences/espanso/default.yml"
57
- else (platform.linux? == true)
58
- config_path = "#{ENV["HOME"]}/.config/espanso/default.yml"
59
- end
60
- puts @leading
61
- self.config_path=config_path
62
- self.os_choice = os_choice
63
- puts "We'll set the config path to:"
64
- puts @leading
65
- prompt.ok("#{config_path}")
66
-
67
- end
68
-
69
- # REFACTOR TO PROVIDE PATH
70
- def get_storage()
71
- puts @leading
72
- prompt = TTY::Prompt.new
73
- return snippet_storage = prompt.select("Do your store your snippets in Dropbox or a different directory?", default: 1, active_color: :bright_blue) do |menu|
74
- menu.enum "."
75
-
76
- menu.choice "No I use the default folder.", 1
77
- menu.choice "I use Dropbox.", 2
78
- menu.choice "I use Google Drive", 3
79
- menu.choice "I use Another Directory.", 4
80
- end
81
- puts @leading
82
- self.user_storage = snippet_storage
83
- end
84
-
85
- def generate_config()
86
- if File.exist?("#{ENV["HOMEPATH"]}\\snippet_cli_config.txt") && File.read("#{ENV["HOMEPATH"]}\\snippet_cli_config.txt").include?("CONFIG_PRESENT = TRUE")
87
- else
88
- File.open("#{ENV["HOMEPATH"]}/snippet_cli_config.txt", "a") { |f| f.write "NAME = #{self.user_name}\n"}
89
- File.open("#{ENV["HOMEPATH"]}/snippet_cli_config.txt", "a") { |f| f.write "#{self.config_path}\n"}
90
- File.open("#{ENV["HOMEPATH"]}/snippet_cli_config.txt", "a") { |f| f.write "CONFIG_PRESENT = TRUE\n"}
91
- end
92
- end
93
-
94
- def execute(input: $stdin, output: $stdout)
95
- show_banner()
96
- self.get_name()
97
- self.get_os()
98
- output.puts @leading
99
- output.puts "Thanks, that's all we need to know about your configuration."
100
- output.puts @leading
101
- output.puts @leading
102
- output.puts "You can now type snippet_cli new to get started."
103
- output.puts @leading
104
- self.generate_config()
105
- end
106
- end
107
- end
108
- end
1
+ require_relative '../command'
2
+ require 'bundler/setup'
3
+ require 'tty-box'
4
+ require 'tty-prompt'
5
+ require 'tty-platform'
6
+ # frozen_string_literal: true
7
+
8
+
9
+ module SnippetCli
10
+ module Commands
11
+ class Setup < SnippetCli::Command
12
+ platform= TTY::Platform.new
13
+ @leading = " "
14
+ attr_accessor :user_name,:config_path,:user_storage,:config_present,:os_choice
15
+
16
+ def initialize()
17
+ @user_name = user_name
18
+ @config_path = config_path
19
+ @user_storage = user_storage
20
+ @os_choice = os_choice
21
+ @config_present = config_present
22
+ end
23
+
24
+ def show_banner()
25
+ box = TTY::Box::frame(width:67, height:11, border: :thick, align: :left) do
26
+ "
27
+ ##### # # ### ###### ###### ####### #######
28
+ # # ## # # # # # # # #
29
+ # # # # # # # # # # #
30
+ ##### # # # # ###### ###### ##### #
31
+ # # # # # # # # #
32
+ # # # ## # # # # #
33
+ ##### # # ### # # ####### # CLI
34
+ "
35
+ end
36
+ puts box
37
+ end
38
+
39
+ def get_name()
40
+ puts @leading
41
+ prompt = TTY::Prompt.new
42
+ name = prompt.ask("⟶ To begin setup, may I have your name?", default: ENV["USER"], active_color: :bright_blue) do |q|
43
+ q.required true
44
+ end
45
+ puts @leading
46
+ self.user_name = name
47
+ end
48
+
49
+ def get_os()
50
+ puts @leading
51
+ puts "Checking what os you're using..."
52
+ os_choice = platform.os()
53
+ if (platform.windows? == true)
54
+ config_path = "#{ENV["HOMEPATH"]}\\AppData\\Roaming\\espanso\\default.yml"
55
+ elsif (platform.mac? == true)
56
+ config_path = "#{ENV["HOME"]}/Library/Preferences/espanso/default.yml"
57
+ else (platform.linux? == true)
58
+ config_path = "#{ENV["HOME"]}/.config/espanso/default.yml"
59
+ end
60
+ puts @leading
61
+ self.config_path=config_path
62
+ self.os_choice = os_choice
63
+ puts "We'll set the config path to:"
64
+ puts @leading
65
+ prompt.ok("#{config_path}")
66
+
67
+ end
68
+
69
+ # REFACTOR TO PROVIDE PATH
70
+ def get_storage()
71
+ puts @leading
72
+ prompt = TTY::Prompt.new
73
+ return snippet_storage = prompt.select("Do your store your snippets in Dropbox or a different directory?", default: 1, active_color: :bright_blue) do |menu|
74
+ menu.enum "."
75
+
76
+ menu.choice "No I use the default folder.", 1
77
+ menu.choice "I use Dropbox.", 2
78
+ menu.choice "I use Google Drive", 3
79
+ menu.choice "I use Another Directory.", 4
80
+ end
81
+ puts @leading
82
+ self.user_storage = snippet_storage
83
+ end
84
+
85
+ def generate_config()
86
+ if File.exist?("#{ENV["HOMEPATH"]}\\snippet_cli_config.txt") && File.read("#{ENV["HOMEPATH"]}\\snippet_cli_config.txt").include?("CONFIG_PRESENT = TRUE")
87
+ else
88
+ File.open("#{ENV["HOMEPATH"]}/snippet_cli_config.txt", "a") { |f| f.write "NAME = #{self.user_name}\n"}
89
+ File.open("#{ENV["HOMEPATH"]}/snippet_cli_config.txt", "a") { |f| f.write "#{self.config_path}\n"}
90
+ File.open("#{ENV["HOMEPATH"]}/snippet_cli_config.txt", "a") { |f| f.write "CONFIG_PRESENT = TRUE\n"}
91
+ end
92
+ end
93
+
94
+ def execute(input: $stdin, output: $stdout)
95
+ show_banner()
96
+ self.get_name()
97
+ self.get_os()
98
+ output.puts @leading
99
+ output.puts "Thanks, that's all we need to know about your configuration."
100
+ output.puts @leading
101
+ output.puts @leading
102
+ output.puts "You can now type snippet_cli new to get started."
103
+ output.puts @leading
104
+ self.generate_config()
105
+ end
106
+ end
107
+ end
108
+ end
@@ -1,3 +1,3 @@
1
1
  module SnippetCli
2
- VERSION = "0.2.3"
2
+ VERSION = "0.3.2"
3
3
  end
@@ -1,85 +1,85 @@
1
- # Some Definitions for the sake of readability.
2
- module SnippetGenerator
3
- NEW_LINE="\n"
4
- QUOTE = '"'
5
-
6
- #Just writes matches: at the beginning of file so espanso can read the mapping.
7
-
8
- def initialize_espanso_yml(file_to_write)
9
- File.open(file_to_write,"a") { |file| file.write('matches:'+NEW_LINE) }
10
- end
11
-
12
- #Writes a snippet to file when given trigger and replacement strings.
13
-
14
- def single_snippet_export(file_to_write,trigger,replacement)
15
- File.open(file_to_write,"a") { |file| file.write(NEW_LINE+' - trigger: '+'":'+trigger+QUOTE+NEW_LINE) }
16
- File.open(file_to_write,"a") { |file| file.write(' replace: |-'+NEW_LINE) }
17
- if (replacement.instance_of?(String)) then
18
- File.open(file_to_write,"a") { |file| file.write(' '+replacement) }
19
- else
20
- replacement.each do |item|
21
- File.open(file_to_write,"a") { |file| file.write(' '+item) }
22
- end
23
- end
24
- File.open(file_to_write,"a") { |file| file.write(NEW_LINE) }
25
- end
26
-
27
- # New a YAML Comment to separate sections of snippet file.
28
-
29
- def heading_snippet_export(file_to_write,heading)
30
- File.open(file_to_write,"a") { |file| file.write("# "+ heading+NEW_LINE) }
31
- end
32
-
33
- # Any input fields should be entered with double brackets around them when passed in as form_statement
34
- # For example "AJ likes coding in {{language}} and using {{editor}} to write code."
35
-
36
- def input_form_snippet_export(file_to_write, form_trigger,form_statement)
37
- File.open(file_to_write,"a") { |file| file.write(' - trigger: '+QUOTE+':'+form_trigger+QUOTE+NEW_LINE) }
38
- File.open(file_to_write,"a") { |file| file.write(' form: |-'+NEW_LINE)}
39
- if (form_statement.instance_of?(String)) then
40
- File.open(file_to_write,"a") { |file| file.write(' '+form_statement)}
41
- else
42
- form_statement.each do |item|
43
- File.open(file_to_write,"a") { |file| file.write(' '+item) }
44
- end
45
- end
46
- File.open(file_to_write,"a") { |file| file.write(NEW_LINE) }
47
- end
48
- ## ! TO DO: REFACTOR FORM METHODS INTO ONE METHOD which accounts for all cases. Add comments clarifying
49
- ## ! DATA STRUCTURE NEEDED.
50
- #Takes a string for trigger. form_values should be an array.form_fields should also be of type array.
51
- #Parses statements and news picklists based on form fields and values for each field provided
52
-
53
- def picklist_snippet_export(form_trigger,statement,form_fields,formvalues,file_to_write)
54
- form_fields.each do |value|
55
- value+':'
56
- end
57
- form_type = 'choice'
58
- File.open(file_to_write,"a") { |file| file.write(' - trigger: '+'":'+form_trigger+QUOTE+NEW_LINE) }
59
- File.open(file_to_write,"a") { |file| file.write(' form: '+QUOTE+statement+QUOTE+NEW_LINE) }
60
- form_fields.each do |value|
61
- File.open(file_to_write,"a") { |file| file.write(' form_fields:'+NEW_LINE) }
62
- File.open(file_to_write,"a") { |file| file.write(' '+form_fields+NEW_LINE) }
63
- File.open(file_to_write,"a") { |file| file.write(' type: '+ form_type+NEW_LINE) }
64
- File.open(file_to_write,"a") { |file| file.write(' values:'+NEW_LINE) }
65
- formvalues.each do |value|
66
- File.open(file_to_write,"a") { |file| file.write(' - '+QUOTE+value+QUOTE+NEW_LINE) }
67
- end
68
- end
69
-
70
- end
71
-
72
- # News a snippet with large text box
73
-
74
- def textarea_snippet_export(file_to_write)
75
- File.open(file_to_write,"a") { |file| file.write(' - trigger: '+QUOTE+':'+form_trigger+QUOTE+NEW_LINE) }
76
- File.open(file_to_write,"a") { |file| file.write(' form: |'+NEW_LINE)}
77
- File.open(file_to_write,"a") { |file| file.write(' '+form_statement+NEW_LINE)}
78
- File.open(file_to_write,"a") { |file| file.write(' '+field_names+NEW_LINE) }
79
- File.open(file_to_write,"a") { |file| file.write(' '+"multiline: true"+NEW_LINE) }
80
- end
81
-
82
- ## Form Generator Method. Will make form that has, .
83
- ## Takes a few arrays as arguments.
84
- ## Form Fields: Just string in array, but in form context represented as {{Form Field Name}}
1
+ # Some Definitions for the sake of readability.
2
+ module SnippetGenerator
3
+ NEW_LINE="\n"
4
+ QUOTE = '"'
5
+
6
+ #Just writes matches: at the beginning of file so espanso can read the mapping.
7
+
8
+ def initialize_espanso_yml(file_to_write)
9
+ File.open(file_to_write,"a") { |file| file.write('matches:'+NEW_LINE) }
10
+ end
11
+
12
+ #Writes a snippet to file when given trigger and replacement strings.
13
+
14
+ def single_snippet_export(file_to_write,trigger,replacement)
15
+ File.open(file_to_write,"a") { |file| file.write(NEW_LINE+' - trigger: '+'":'+trigger+QUOTE+NEW_LINE) }
16
+ File.open(file_to_write,"a") { |file| file.write(' replace: |-'+NEW_LINE) }
17
+ if (replacement.instance_of?(String)) then
18
+ File.open(file_to_write,"a") { |file| file.write(' '+replacement) }
19
+ else
20
+ replacement.each do |item|
21
+ File.open(file_to_write,"a") { |file| file.write(' '+item) }
22
+ end
23
+ end
24
+ File.open(file_to_write,"a") { |file| file.write(NEW_LINE) }
25
+ end
26
+
27
+ # New a YAML Comment to separate sections of snippet file.
28
+
29
+ def heading_snippet_export(file_to_write,heading)
30
+ File.open(file_to_write,"a") { |file| file.write("# "+ heading+NEW_LINE) }
31
+ end
32
+
33
+ # Any input fields should be entered with double brackets around them when passed in as form_statement
34
+ # For example "AJ likes coding in {{language}} and using {{editor}} to write code."
35
+
36
+ def input_form_snippet_export(file_to_write, form_trigger,form_statement)
37
+ File.open(file_to_write,"a") { |file| file.write(' - trigger: '+QUOTE+':'+form_trigger+QUOTE+NEW_LINE) }
38
+ File.open(file_to_write,"a") { |file| file.write(' form: |-'+NEW_LINE)}
39
+ if (form_statement.instance_of?(String)) then
40
+ File.open(file_to_write,"a") { |file| file.write(' '+form_statement)}
41
+ else
42
+ form_statement.each do |item|
43
+ File.open(file_to_write,"a") { |file| file.write(' '+item) }
44
+ end
45
+ end
46
+ File.open(file_to_write,"a") { |file| file.write(NEW_LINE) }
47
+ end
48
+ ## ! TO DO: REFACTOR FORM METHODS INTO ONE METHOD which accounts for all cases. Add comments clarifying
49
+ ## ! DATA STRUCTURE NEEDED.
50
+ #Takes a string for trigger. form_values should be an array.form_fields should also be of type array.
51
+ #Parses statements and news picklists based on form fields and values for each field provided
52
+
53
+ def picklist_snippet_export(form_trigger,statement,form_fields,formvalues,file_to_write)
54
+ form_fields.each do |value|
55
+ value+':'
56
+ end
57
+ form_type = 'choice'
58
+ File.open(file_to_write,"a") { |file| file.write(' - trigger: '+'":'+form_trigger+QUOTE+NEW_LINE) }
59
+ File.open(file_to_write,"a") { |file| file.write(' form: '+QUOTE+statement+QUOTE+NEW_LINE) }
60
+ form_fields.each do |value|
61
+ File.open(file_to_write,"a") { |file| file.write(' form_fields:'+NEW_LINE) }
62
+ File.open(file_to_write,"a") { |file| file.write(' '+form_fields+NEW_LINE) }
63
+ File.open(file_to_write,"a") { |file| file.write(' type: '+ form_type+NEW_LINE) }
64
+ File.open(file_to_write,"a") { |file| file.write(' values:'+NEW_LINE) }
65
+ formvalues.each do |value|
66
+ File.open(file_to_write,"a") { |file| file.write(' - '+QUOTE+value+QUOTE+NEW_LINE) }
67
+ end
68
+ end
69
+
70
+ end
71
+
72
+ # News a snippet with large text box
73
+
74
+ def textarea_snippet_export(file_to_write)
75
+ File.open(file_to_write,"a") { |file| file.write(' - trigger: '+QUOTE+':'+form_trigger+QUOTE+NEW_LINE) }
76
+ File.open(file_to_write,"a") { |file| file.write(' form: |'+NEW_LINE)}
77
+ File.open(file_to_write,"a") { |file| file.write(' '+form_statement+NEW_LINE)}
78
+ File.open(file_to_write,"a") { |file| file.write(' '+field_names+NEW_LINE) }
79
+ File.open(file_to_write,"a") { |file| file.write(' '+"multiline: true"+NEW_LINE) }
80
+ end
81
+
82
+ ## Form Generator Method. Will make form that has, .
83
+ ## Takes a few arrays as arguments.
84
+ ## Form Fields: Just string in array, but in form context represented as {{Form Field Name}}
85
85
  end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file