Skip to content

Commit

Permalink
refactor escape codes
Browse files Browse the repository at this point in the history
  • Loading branch information
arturopala committed May 14, 2021
1 parent 05befe6 commit 2668008
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Empty file.
4 changes: 3 additions & 1 deletion src/main/scala/com/github/arturopala/makeitg8/AskUser.scala
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ package com.github.arturopala.makeitg8
import scala.annotation.tailrec
import scala.io.StdIn

trait AskUser extends EscapeCodes {
trait AskUser {

import EscapeCodes._

final def askYesNo(prompt: String): Boolean =
ask[Boolean](
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import org.rogach.scallop.exceptions.{RequiredOptionNotFound, UnknownOption}
import scala.util.control.NonFatal
import scala.util.Try

class CommandLine(arguments: Seq[String]) extends ScallopConf(arguments) with EscapeCodes {
class CommandLine(arguments: Seq[String]) extends ScallopConf(arguments) {

import EscapeCodes._

val sourcePath =
opt[Path](name = "source", short = 's', descr = "Source code path, absolute or relative")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package com.github.arturopala.makeitg8

trait EscapeCodes {
object EscapeCodes {
// colors
val ANSI_RESET = "\u001B[0m"
val ANSI_BLACK = "\u001B[30m"
Expand Down
4 changes: 3 additions & 1 deletion src/main/scala/com/github/arturopala/makeitg8/MakeItG8.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ import java.net.URI
import java.nio.file.Path
import java.net.URLEncoder

object MakeItG8 extends App with MakeItG8Creator with AskUser with EscapeCodes {
object MakeItG8 extends App with MakeItG8Creator with AskUser {

import EscapeCodes._

readConfig().fold(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ import java.nio.file.attribute.PosixFilePermission

import scala.util.{Failure, Try}

trait MakeItG8Creator extends EscapeCodes {
trait MakeItG8Creator {

import EscapeCodes._

def createG8Template(config: MakeItG8Config): Either[Throwable, Unit] =
Try {
Expand Down

0 comments on commit 2668008

Please sign in to comment.