sdkman 的酷炫 Logo 欢迎界面: 安装 kscript (Kotlin Shell)

2021-06-09 14:21:29 浏览数 (1)

安装 sdkman

代码语言:javascript复制
$curl -s "https://get.sdkman.io" | bash
代码语言:javascript复制
                                - syyyyyyys:
                            `/yho:`       -yd.
                         `/yh/`              m.
                       .oho.                 hy                          .`
                     .sh/`                   :N`                `-/o`  ` dyyo:.
                   .yh:`                     `M-          `-/osysoym  :hs` `- sys:      hhyssssssssy 
                 .sh:`                       `N:          ms/-``  yy.yh-      -hy.    `.N-```````` N.
               `od/`                         `N-       -/oM-      ddd `     `sd:     hNNm        -N:
              :do`                           .M.       dMMM-     `ms.      /d `     `NMMs       `do
            .yy-                             :N`    ```mMMM.      -      -hy.       /MMM:       yh
          ` d `           `:/oo/`       `-/osyh/ossssssdNMM`           .sh:         yMMN`      /m.
         -dh-           :ymNMMMMy  `-/shmNm-`:N/-.``   `.sN            /N-         `NMMy      .m/
       `oNs`          -hysosmMMMMydmNmds -.:ohm           :             sd`        :MMM/      yy
      .hN            /d:    -MMMmhs/-.`   .MMMh   .ss -                 `yy`       sMMN`     :N.
     :mN/           `N/     `o/-`         :MMMo    MMMN-         .`      `ds       mMMh      do
    /NN/            `N ....--:/ oooosooo :sMMM:   hMMMM:        `my       .m      -MMM      :N.
   /NMo              - ooooo /:-....`...: hNMN.  `NMMMd`        .MM/       -m:    oMMN.     hs
  -NMd`                                    :mm   -MMMm- .s/     -MMm.       /m-   mMMd     -N.
 `mMM/                                      .-   /MMh. -dMo     -MMMy        od. .MMMs..---yh
  MMM.                                           sNo`.sNMM      :MMMM/        sh` MMMNmNm   -
 mMMM-                                           /--ohmMMM      :MMMMm.       `hyymmmdddo
 MMMMh.                  ````                  `- yy/`yMMM/     :MMMMMy       -sm:.``..-:-.`
 dMMMMmo-.``````..-:/osyhddddho.           ` shdh .   hMMM:     :MmMMMM/   ./yy/` `:sys / sh/
 .dMMMMMMmdddddmmNMMMNNNNNMMMMMs           sNdo-      dMMM-  `-/yd/MMMMm-:sy .   :hs-      /N`
  `/ymNNNNNNNmmdys /::----/dMMm:           m-         mMMM ohmo/.` sMMMMdo-    .om:       `sh
     `.----- /.`       `.- hh/`         `od.          NMMNmds/     `mmy:`      mMy      `:yy.
           /moyso // ossso:.           .yy`          `dy :`         ..       :MMMN ---/oys:
         / m:  `.-:::-`               /d                                      MMMMMMMNh:`
         MN/                        -yh.                                     ` hddhy .
       /MM                        .sh:
      :NMo                      -sh/
     -NMs                    `/yy:
    .NMy                  `:sh .
   `mMm`               ./yds-
  `dMMMmyo:-.````.-:oymNy:`
   NMMMMMMMMMMMMMMMMms:`
    - shmNMMMNmdy :`


                                                                 Now attempting installation...


Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime the config file...
Download script archive...
#=#=#                                                                         
-=O=-        #   #     #     #          

Installation

To use kscript just Kotlin and Maven are required. To install Kotlin we recommend sdkman:

代码语言:javascript复制
curl -s "https://get.sdkman.io" | bash  # install sdkman
source ~/.bash_profile                  # add sdkman to PATH
 
sdk install kotlin                      # install Kotlin

Once Kotlin is ready, you can install kscript with

代码语言:javascript复制
sdk install kscript

To test your installation simply run

代码语言:javascript复制
kscript --help

This will check and inform about udpates. To update kscript simply install it again as described above.

Interpreter Usage

To use kscript as interpreter for a script just point to it in the shebang line of your Kotlin scripts:

代码语言:javascript复制
#!/usr/bin/env kscript
 
println("Hello from Kotlin!")
for (arg in args) {
    println("arg: $arg")
}

参考资料

更多内容参考:https://www.kotlinresources.com/library/kscript/

0 人点赞