Skip to content

jamesward/zio-main

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zio-main

A Scala MacroAnnotation that makes it easy to create mains for ZIO apps.

@zioMain
val run =
  Console.printLine("hello, world")

@zioMain
val runWithArg =
  for
    args <- ZIOAppArgs.getArgs
    name <- ZIO.fromOption(args.headOption)
    _    <- Console.printLine(s"hello, $name")
  yield
    ()

Note: Due to a Scala bug, this doesn't work with sbt. So we use scala-cli instead.

Run without args:

scala-cli run Hello.scala -O -experimental --server=false --watch --main-class Hello\$package\$run .

Run with args:

scala-cli run Hello.scala -O -experimental --server=false --watch --main-class Hello\$package\$runWithArg . -- james

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published