[cli] Remove verbosity flag (#63)
This commit is contained in:
parent
03227a3720
commit
90770eaafb
7 changed files with 8 additions and 12 deletions
|
@ -15,6 +15,10 @@ The format is based on [[https://keepachangelog.com/en/1.0.0/][Keep a Changelog]
|
|||
|
||||
- Suppress Transfer event messages
|
||||
|
||||
** Removed
|
||||
|
||||
- ~-v~ verbosity flag
|
||||
|
||||
* [0.4.0] - 2019-06-11
|
||||
|
||||
** Added
|
||||
|
|
|
@ -22,7 +22,6 @@ hash of the file contents.
|
|||
-i, --include <value> Include matching paths
|
||||
-x, --exclude <value> Exclude matching paths
|
||||
-d, --debug Enable debug logging
|
||||
-v, --verbose <value> Verbosity level (1-5)
|
||||
#+end_example
|
||||
|
||||
The ~--include~ and ~--exclude~ parameters can be used more than once.
|
||||
|
|
|
@ -12,7 +12,7 @@ object Main extends IOApp {
|
|||
Config(source = Paths.get(".").toFile)
|
||||
|
||||
override def run(args: List[String]): IO[ExitCode] = {
|
||||
val exitCaseLogger = new PrintLogger[IO](1, false)
|
||||
val exitCaseLogger = new PrintLogger[IO](false)
|
||||
ParseArgs(args, defaultConfig)
|
||||
.map(Program[IO])
|
||||
.getOrElse(IO(ExitCode.Error))
|
||||
|
|
|
@ -37,13 +37,7 @@ object ParseArgs {
|
|||
.text("Exclude matching paths"),
|
||||
opt[Unit]('d', "debug")
|
||||
.action((_, c) => c.copy(debug = true))
|
||||
.text("Enable debug logging"),
|
||||
opt[Int]('v', "verbose")
|
||||
.validate(i =>
|
||||
if (i >= 1 && i <= 5) Right(Unit)
|
||||
else Left("Verbosity level must be between 1 and 5"))
|
||||
.action((i, c) => c.copy(verbose = i))
|
||||
.text("Verbosity level (1-5)")
|
||||
.text("Enable debug logging")
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ package net.kemitix.s3thorp.cli
|
|||
import cats.Monad
|
||||
import net.kemitix.s3thorp.domain.Logger
|
||||
|
||||
class PrintLogger[M[_]: Monad](verbosity: Int, isDebug: Boolean) extends Logger[M] {
|
||||
class PrintLogger[M[_]: Monad](isDebug: Boolean) extends Logger[M] {
|
||||
|
||||
override def debug(message: => String): M[Unit] =
|
||||
if (isDebug) Monad[M].pure(println(s"[ DEBUG] $message"))
|
||||
|
|
|
@ -10,7 +10,7 @@ import net.kemitix.s3thorp.domain.{Config, Logger}
|
|||
object Program {
|
||||
|
||||
def apply[M[_]: Monad](config: Config): M[ExitCode] = {
|
||||
implicit val logger: Logger[M] = new PrintLogger[M](config.verbose, config.debug)
|
||||
implicit val logger: Logger[M] = new PrintLogger[M](config.debug)
|
||||
for {
|
||||
_ <- logger.info("S3Thorp - hashed sync for s3")
|
||||
_ <- Sync.run[M](config, S3ClientBuilder.defaultClient)
|
||||
|
|
|
@ -5,7 +5,6 @@ import java.io.File
|
|||
final case class Config(
|
||||
bucket: Bucket = Bucket(""),
|
||||
prefix: RemoteKey = RemoteKey(""),
|
||||
verbose: Int = 1,
|
||||
filters: List[Filter] = List(),
|
||||
multiPartThreshold: Long = 1024 * 1024 * 5,
|
||||
maxRetries: Int = 3,
|
||||
|
|
Loading…
Reference in a new issue