add main cxl.rb, Cxl::VERSION, and initial CLI processing
This commit is contained in:
parent
04d7558579
commit
b7564637ca
2
bin/cxlc
2
bin/cxlc
@ -5,6 +5,6 @@ $LOAD_PATH << "#{lib_dir}/cxl/lib"
|
||||
$LOAD_PATH << "#{lib_dir}/yawpa/lib"
|
||||
$LOAD_PATH << "#{lib_dir}/whittle/lib"
|
||||
|
||||
require "cxl/cli"
|
||||
require "cxl"
|
||||
|
||||
exit(Cxl::Cli.run(ARGV.dup))
|
||||
|
2
lib/cxl/cxl/lib/cxl.rb
Normal file
2
lib/cxl/cxl/lib/cxl.rb
Normal file
@ -0,0 +1,2 @@
|
||||
require "cxl/cli"
|
||||
require "cxl/version"
|
@ -2,10 +2,33 @@ module Cxl
|
||||
class Cli
|
||||
class << self
|
||||
|
||||
HELP_TEXT = <<EOF
|
||||
Usage: clxc [options] <input-files...> -- <C-compiler-flags>
|
||||
Options:
|
||||
--version show version and exit
|
||||
--help, -h show this help and exit
|
||||
-c compile only (no link)
|
||||
-o OUTPUT send output to file OUTPUT
|
||||
EOF
|
||||
|
||||
def run(params)
|
||||
require "yawpa"
|
||||
|
||||
puts "Coming soon..."
|
||||
options = {
|
||||
version: {},
|
||||
help: {short: "h"},
|
||||
compile_only: {short: "c"},
|
||||
output: {short: "o", nargs: 1},
|
||||
}
|
||||
opts, args = Yawpa.parse(params, options, posix_order: true)
|
||||
if opts[:version]
|
||||
puts "clxc, version #{Cxl::VERSION}"
|
||||
return 0
|
||||
end
|
||||
if opts[:help]
|
||||
puts HELP_TEXT
|
||||
return 0
|
||||
end
|
||||
|
||||
0
|
||||
end
|
||||
|
3
lib/cxl/cxl/lib/cxl/version.rb
Normal file
3
lib/cxl/cxl/lib/cxl/version.rb
Normal file
@ -0,0 +1,3 @@
|
||||
module Cxl
|
||||
VERSION = "0.0.1"
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user