-
-
Save sdondley/d73d48449b924fd2774416d6e0a01cee to your computer and use it in GitHub Desktop.
command file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env raku | |
use lib 'lib'; | |
use Vimwiki::File; | |
# passed from vimwiki | |
#1. force : [0/1] overwrite an existing file | |
#2. syntax : the syntax chosen for this wiki | |
#3. extension : the file extension for this wiki | |
#4. output_dir : the full path of the output directory | |
#5. input_file : the full path of the wiki page | |
#6. css_file : the full path of the css file for this wiki | |
#7. template_path : the full path to the wiki's templates | |
#8. template_default : the default template name | |
#9. template_ext : the extension of template files | |
#10. root_path : a count of ../ for pages buried in subdirs | |
# For example, if you have wikilink [[dir1/dir2/dir3/my page in a subdir]] | |
# then this argument is '../../../'. | |
#11. custom_args : custom arguments that will be passed to the conversion | |
# (can be defined in g:vimwiki_list as 'custom_wiki2html_args' parameter, | |
# see |vimwiki-option-custom_wiki2html_args|) | |
# script. | |
# | |
#Options 7-11 are experimental and may change in the future. If any of these | |
#parameters is empty, a hyphen "-" is passed to the script in its place. | |
my $verbose; | |
multi process_args(@args where @args.elems == 0) { | |
die "No arguments passed to the $*PROGRAM. You must pass in at least a file name that can be parsed."; | |
} | |
multi process_args(@args where @args.elems == 1) { | |
my $vwf = Vimwiki::File.new(:path(@args[0])); | |
putv $vwf.so, | |
'Successfully ingested file into the Vimwiki::File Raku module', | |
'Could not ingest file.'; | |
} | |
#multi process_args( @args where @args.elems == 2 ) { | |
# my $vwf = Vimwiki::File.new( :path(@args[0]), :verbose(1) ); | |
# putv $vwf.so, | |
# 'Successfully ingested file into the Vimwiki::File Raku module', | |
# 'Could not ingest file.'; | |
#} | |
# | |
#multi process_args(@args where @args.elems > 2) { | |
# | |
# my $sig; | |
# for <force_overwrite syntax extenstion output_dir input_file css_file | |
# template_path template_default template_ext root_path verbose> | |
# { | |
# | |
# | |
# } | |
# | |
# my $vwf = Vimwiki::File.new( | |
# :force_overwrite\ (@args[0]), | |
# :syntax\ (@args[1]), | |
# :extension\ (@args[2]), | |
# :output_dir\ (@args[3]), | |
# :input_file\ (@args[4]), | |
# :css_file\ (@args[5]), | |
# :template_path\ (@args[6]), | |
# :template_default\ (@args[7]), | |
# :template_ext\ (@args[8]), | |
# :root_path\ (@args[9]), | |
# :verbose\ (@args[11]), | |
# ); | |
# putv $vwf.so, | |
# 'Successfully ingested file into the Vimwiki::File Raku module', | |
# 'Could not ingest file.'; | |
# | |
#} | |
sub MAIN(*@args) { | |
# check to make sure we have some args | |
process_args(@args); | |
} | |
sub putv (Bool:D $bool, Str:D $true_msg, Str:D $false_msg) { | |
put ($bool ?? $true_msg !! $false_msg); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment