updated .gitignor
This commit is contained in:
+11
-14
@@ -1,14 +1,11 @@
|
|||||||
# Crystal build artifacts
|
*
|
||||||
/.build/
|
!CLAUDE.md
|
||||||
/bin/
|
!src/
|
||||||
|
!src/**
|
||||||
# Compiled test binary (crystal build test.cr)
|
!shard.yml
|
||||||
test
|
!README.md
|
||||||
|
!design.adoc
|
||||||
# Shards cache
|
!docs/
|
||||||
/.shards/
|
!docs/**
|
||||||
/lib/
|
!Makefile
|
||||||
|
!LICENSE
|
||||||
# Editor
|
|
||||||
tags
|
|
||||||
.DS_Store
|
|
||||||
|
|||||||
@@ -1,52 +0,0 @@
|
|||||||
require "./src/cligen"
|
|
||||||
|
|
||||||
#CliGen.override_help_template "test.ecr"
|
|
||||||
|
|
||||||
module MyModule
|
|
||||||
class MyData
|
|
||||||
extend CliGen::Coercable
|
|
||||||
extend CliGen::Parseable
|
|
||||||
|
|
||||||
DELIMITER = '.'
|
|
||||||
|
|
||||||
getter val : Int32
|
|
||||||
|
|
||||||
def initialize(@val : Int32)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.parse_args(args : Array(CliGen::Arg)) : MyData
|
|
||||||
arg = args.first
|
|
||||||
arg.processed
|
|
||||||
new(val: arg.value.to_i32)
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.coerce(arg : String) : MyData
|
|
||||||
if arg =~ /^[[:digit:]]+$/
|
|
||||||
new(val: arg.to_i32)
|
|
||||||
else
|
|
||||||
raise "ERROR parsing #{arg}"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
@[CliGen::CommandInfo(description: "Test")]
|
|
||||||
class MyClass < CliGen::Command
|
|
||||||
|
|
||||||
|
|
||||||
argument(myvar3 : Array(MyModule::MyData), description: "Custom data")
|
|
||||||
|
|
||||||
argument(myvar2 : MyModule::MyData, description: "Custom data", validation: ->(v : MyModule::MyData) : Bool { v.val != 2 })
|
|
||||||
|
|
||||||
argument(myvar : Int32 = 123, description: "Set myvar", validation: ->(v : Int32) : Bool { (0..123).includes?(v) }, on_match: ->() : Nil { puts "Was called" })
|
|
||||||
|
|
||||||
subcommand dothing : Nil, description: "DOING ALL THE THINGS" do
|
|
||||||
puts "DO THE THING : myvar : #{@myvar}"
|
|
||||||
puts @myvar2.val
|
|
||||||
@myvar3.each do |var|
|
|
||||||
puts var.val
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
CliGen::App.process
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user