~mclehman/app-ryomod

6c0304e3d90213835be1f6f034a0f19ac277c3c2 — 0xFORDCOMMA 3 years ago 6d0ec73
Refactor init subcommand multis to single version with default arg.
2 files changed, 6 insertions(+), 14 deletions(-)

M META6.json
M bin/ryomod
M META6.json => META6.json +1 -1
@@ 16,5 16,5 @@
  "scripts": {
    "test": "zef test ."
  },
  "version": "2020.01.07"
  "version": "2020.01.07.1"
}
\ No newline at end of file

M bin/ryomod => bin/ryomod +5 -13
@@ 29,19 29,11 @@ subset LibSubcommand     of Str where * ~~ / :i @lib-aliases     /;
subset TestSubcommand    of Str where * ~~ / :i @test-aliases    /;

multi MAIN(InitSubcommand,
           :%config  = load-config(),
           :$license = %config<license>,
           :@authors = %config<authors>,
           :$name    = %*ENV<PWD>.IO.basename) {
    samewith @init-aliases.head, $*CWD, :%config, :$license, :@authors, :$name;
}

multi MAIN(InitSubcommand,
           $path,
           :%config  = load-config(),
           :$license = %config<license>,
           :@authors = %config<authors>,
           :$name    = %*ENV<PWD>.IO.basename) {
           Str $path     = $*CWD,
               :%config  = load-config(),
           Str :$license = %config<license>,
           Str :@authors = %config<authors>,
           Str :$name    = %*ENV<PWD>.IO.basename) {
    if $path.IO.add('META6.json').e {
        note 'META6.json already exists, aborting.' and exit
    }