Class: SlashCLI::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/cli.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(command, *args) ⇒ Object



38
39
40
41
42
43
# File 'lib/cli.rb', line 38

def method_missing(command, *args)
	puts ""
	puts "| Unknown subcommand: #{command}."
	puts "|-- Use 'slash help' for available commands."
	puts ""
end

Instance Method Details

#compile(file: "main.slash", output: "output.rb") ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/cli.rb', line 11

def compile(file: "main.slash", output: "output.rb")
	puts ""
	puts "Preparing compiler..."
	functions_file = File.expand_path("../../config/slashcode.toml", __FILE__)
	compiler = Compiler::Compiler.new(file, functions_file, output)
	puts "Compiling #{file}..."
	compiler.compile
	puts "#{file} has been compiled to #{output}!"
	puts ""
end

#helpObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/cli.rb', line 23

def help
	puts ""
	puts "| Help information for the slashcode CLI:"
	puts "|----------------------------------------"
	puts "|"
	puts "| help"
	puts "|-- Show this help text"
	puts "|"
	puts "| compile <filename>"
	puts "|-- Compile a slahscode file"
	puts "|"
	puts "|----------------------------------------"
	puts ""
end