使用 Perl 6 创建 Jekyll 文章模版

#| 使用 Perl 6 自动创建 Jekyll 文章模版
sub MAIN(:$f) {
    my $file = Date.today ~ '-' ~ $f.subst(/\s+/, '-', :g) ~ '.md';
    chdir "/Users/ohmycloud/blogs/youngforperl6" or die;
    shell("git fetch origin master");
    chdir "/Users/ohmycloud/blogs/youngforperl6/_posts" or die;
    my $fh = "$file".IO.open(:mode, :create);

    $fh.say: qq:to/EOF/;
    ---
    layout: post
    title: $f
    categories: [Perl 6]
    tags: [Perl6]
    ---
    EOF
    shell("Atom $file");
}

使用:

perl6 test.pl6 -f='使用 Perl 6 创建 Jekyll 文章模版'

你可能感兴趣的:(使用 Perl 6 创建 Jekyll 文章模版)