Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix case-app initialization #195

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
apps: 'sbt'
- name: Test
run: sbt +test
- name: Print help
run: sbt "cli/run --help"

publish:
needs: test
Expand Down
9 changes: 4 additions & 5 deletions modules/cli/src/main/scala/packager/cli/PackagerCli.scala
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
package packager.cli

import caseapp.core.app.CommandsEntryPoint
import caseapp.core.app.{Command, CommandsEntryPoint}
import packager.cli.commands.Build

object PackagerCli extends CommandsEntryPoint {

final override def defaultCommand = Some(Build)
final override def defaultCommand: Option[Command[_]] = Some(Build)

override def enableCompleteCommand = true
override def enableCompletionsCommand = true

val commands = Seq(
Build
)
def commands: Seq[Command[_]] =
Seq(Build)

override def progName: String = "packager"
}
2 changes: 2 additions & 0 deletions modules/cli/src/main/scala/packager/cli/commands/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package packager.cli.commands
import caseapp.core.RemainingArgs
import caseapp.core.app.Command
import BuildOptions.NativePackagerType._
import caseapp.core.parser.Parser
import packager.cli.commands.BuildOptions.PackagerType.Docker
import packager.config.SharedSettings
import packager.deb.DebianPackage
Expand All @@ -13,6 +14,7 @@ import packager.rpm.RedHatPackage
import packager.windows.{DefaultImageResizer, WindowsPackage}

object Build extends Command[BuildOptions] {
override def name: String = "build"
override def run(
options: BuildOptions,
remainingArgs: RemainingArgs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ object BuildOptions {
case object Rpm extends NativePackagerType
}

implicit val parser: Parser[BuildOptions] = Parser[BuildOptions]
implicit val help: Help[BuildOptions] = Help[BuildOptions]
lazy val parser: Parser[BuildOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[BuildOptions, parser.D] = parser
implicit lazy val help: Help[BuildOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ final case class DebianOptions(
}

case object DebianOptions {

implicit val parser: Parser[DebianOptions] = Parser[DebianOptions]
implicit val help: Help[DebianOptions] = Help[DebianOptions]

lazy val parser: Parser[DebianOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[DebianOptions, parser.D] = parser
implicit lazy val help: Help[DebianOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ final case class DockerOptions(

case object DockerOptions {

implicit val parser: Parser[DockerOptions] = Parser[DockerOptions]
implicit val help: Help[DockerOptions] = Help[DockerOptions]
lazy val parser: Parser[DockerOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[DockerOptions, parser.D] = parser
implicit lazy val help: Help[DockerOptions] = Help.derive

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ final case class MacOSOptions(
}

case object MacOSOptions {

implicit val parser: Parser[MacOSOptions] = Parser[MacOSOptions]
implicit val help: Help[MacOSOptions] = Help[MacOSOptions]

lazy val parser: Parser[MacOSOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[MacOSOptions, parser.D] = parser
implicit lazy val help: Help[MacOSOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ final case class RedHatOptions(
}

case object RedHatOptions {

implicit val parser: Parser[RedHatOptions] = Parser[RedHatOptions]
implicit val help: Help[RedHatOptions] = Help[RedHatOptions]

lazy val parser: Parser[RedHatOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[RedHatOptions, parser.D] = parser
implicit lazy val help: Help[RedHatOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ final case class SharedOptions(
logoPath: Option[String] = None
)
case object SharedOptions {

implicit val parser: Parser[SharedOptions] = Parser[SharedOptions]
implicit val help: Help[SharedOptions] = Help[SharedOptions]
lazy val parser: Parser[SharedOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[SharedOptions, parser.D] = parser
implicit lazy val help: Help[SharedOptions] = Help.derive
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ final case class WindowsOptions(
}

case object WindowsOptions {

implicit val parser: Parser[WindowsOptions] = Parser[WindowsOptions]
implicit val help: Help[WindowsOptions] = Help[WindowsOptions]
lazy val parser: Parser[WindowsOptions] = Parser.derive
implicit lazy val parserAux: Parser.Aux[WindowsOptions, parser.D] = parser
implicit lazy val help: Help[WindowsOptions] = Help.derive
}