-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from alexarchambault/develop
Tweak help / sub-commands stuff
- Loading branch information
Showing
18 changed files
with
287 additions
and
71 deletions.
There are no files selected for viewing
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
17 changes: 17 additions & 0 deletions
17
core/js/src/main/scala/caseapp/core/app/PlatformUtil.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package caseapp.core.app | ||
|
||
import scala.scalajs.js | ||
import js.Dynamic.{global => g} | ||
|
||
object PlatformUtil { | ||
private lazy val process = g.require("process") | ||
def exit(code: Int): Nothing = { | ||
process.exit(code) | ||
sys.error(s"Attempt to exit with code $code failed") | ||
} | ||
def arguments(args: Array[String]): Array[String] = | ||
if (args.isEmpty) | ||
process.argv.asInstanceOf[js.Array[String]].toArray | ||
else | ||
args | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package caseapp.core.app | ||
|
||
object PlatformUtil { | ||
def exit(code: Int): Nothing = | ||
sys.exit(code) | ||
def arguments(args: Array[String]): Array[String] = | ||
args | ||
} |
8 changes: 8 additions & 0 deletions
8
core/native/src/main/scala/caseapp/core/app/PlatformUtil.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package caseapp.core.app | ||
|
||
object PlatformUtil { | ||
def exit(code: Int): Nothing = | ||
sys.exit(code) | ||
def arguments(args: Array[String]): Array[String] = | ||
args | ||
} |
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
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
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
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
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
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
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
10 changes: 10 additions & 0 deletions
10
core/shared/src/main/scala/caseapp/core/help/RuntimeCommandHelp.scala
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package caseapp.core.help | ||
|
||
import dataclass.data | ||
|
||
@data class RuntimeCommandHelp[T]( | ||
names: List[List[String]], | ||
help: Help[T], | ||
group: String, | ||
hidden: Boolean | ||
) |
Oops, something went wrong.