Skip to content
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
246 changes: 6 additions & 240 deletions .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,243 +1,9 @@
version = "3.7.14"
version = "3.8.4"
maxColumn = 80
docstrings.oneline = unfold
docstrings.removeEmpty = false
docstrings.wrap = yes
docstrings.wrapMaxColumn = null
docstrings.forceBlankLineBefore = null
docstrings.blankFirstLine = no
docstrings.style = SpaceAsterisk
comments.wrap = no
comments.wrapSingleLineMlcAsSlc = false
comments.wrapStandaloneSlcAsSlc = false
optIn.configStyleArguments = true
optIn.breaksInsideChains = false
optIn.breakChainOnFirstMethodDot = true
optIn.encloseClassicChains = false
optIn.selfAnnotationNewline = true
optIn.annotationNewlines = true
optIn.forceBlankLineBeforeDocstring = true
binPack.unsafeCallSite = Never
binPack.unsafeDefnSite = Never
binPack.bracketCallSite = null
binPack.bracketDefnSite = null
binPack.indentCallSiteOnce = false
binPack.indentCallSiteSingleArg = true
binPack.parentConstructors = source
binPack.literalArgumentLists = true
binPack.literalsIncludeSimpleExpr = false
binPack.literalsSingleLine = false
binPack.literalsMinArgCount = 5
binPack.literalsInclude = [
".*"
]
binPack.literalsExclude = [
String
"Term.Name"
]
indent.main = 2
indent.significant = null
indent.callSite = 2
indent.ctrlSite = null
encoding = "UTF-8"
runner.dialect = scala3
indent.defnSite = 2
indent.caseSite = 2
indent.matchSite = null
indent.ctorSite = null
indent.extraBeforeOpenParenDefnSite = 0
indent.relativeToLhsLastLine = []
indent.fewerBraces = never
indent.extendSite = 2
indent.withSiteRelativeToExtends = 0
indent.commaSiteRelativeToExtends = 2
align.allowOverflow = false
align.delayUntilSpace = true
align.multiline = false
align.stripMargin = true
align.closeParenSite = false
align.openBracketCallSite = null
align.openParenCallSite = false
align.openParenCtrlSite = false
align.openBracketDefnSite = null
align.openParenDefnSite = false
align.openParenTupleSite = null
align.beforeOpenParenDefnSite = false
align.beforeOpenParenCallSite = false
align.inInterpolation = false
align.tokens = [
{
code = "=>"
owner = Case
owners = []
}
]
align.arrowEnumeratorGenerator = false
align.treeCategory."Defn.Trait" = "class/object/trait/enum"
align.treeCategory."Defn.Object" = "class/object/trait/enum"
align.treeCategory."Defn.Val" = "given/val/var/def"
align.treeCategory."Defn.Enum" = "class/object/trait/enum"
align.treeCategory."Defn.Macro" = "given/val/var/def"
align.treeCategory."Decl.Def" = "given/val/var/def"
align.treeCategory."Defn.Def" = "given/val/var/def"
align.treeCategory."Defn.GivenAlias" = "given/val/var/def"
align.treeCategory."Defn.Var" = "given/val/var/def"
align.treeCategory."Enumerator.Generator" = for
align.treeCategory."Enumerator.Val" = for
align.treeCategory."Defn.Class" = "class/object/trait/enum"
spaces.beforeContextBoundColon = Never
spaces.beforeApplyArgInParens = Never
spaces.beforeInfixArgInParens = Always
spaces.afterTripleEquals = false
spaces.inImportCurlyBraces = false
spaces.inInterpolatedStringCurlyBraces = false
spaces.inParentheses = false
spaces.neverAroundInfixTypes = []
spaces.afterKeywordBeforeParen = true
spaces.inByNameTypes = true
spaces.afterSymbolicDefs = false
literals.long = Upper
literals.float = Lower
literals.double = Lower
literals.hexDigits = Lower
literals.hexPrefix = Lower
literals.scientific = Lower
lineEndings = unix
rewrite.rules = []
rewrite.scala3.convertToNewSyntax = false
rewrite.scala3.removeOptionalBraces = no
rewrite.scala3.countEndMarkerLines = all
rewrite.scala3.removeEndMarkerMaxLines = 0
rewrite.scala3.insertEndMarkerMinLines = 0
rewrite.insertBraces.minLines = 0
rewrite.insertBraces.allBlocks = false
rewrite.redundantBraces.defnBodies = all
rewrite.redundantBraces.includeUnitMethods = true
rewrite.redundantBraces.maxBreaks = 100
rewrite.redundantBraces.stringInterpolation = false
rewrite.redundantBraces.parensForOneLineApply = true
rewrite.redundantBraces.generalExpressions = true
rewrite.redundantBraces.ifElseExpressions = false
rewrite.redundantParens.infixSide = null
rewrite.sortModifiers.order = [
implicit
final
sealed
abstract
override
private
protected
lazy
open
transparent
inline
infix
opaque
]
rewrite.imports.sort = none
rewrite.imports.expand = false
rewrite.imports.contiguousGroups = only
rewrite.imports.groups = []
rewrite.preferCurlyFors.removeTrailingSemicolonsOnly = false
rewrite.trailingCommas.allowFolding = true
rewrite.trailingCommas.style = never
rewrite.allowInfixPlaceholderArg = true
rewrite.neverInfix.excludeFilters = [
until
to
by
eq
ne
"should.*"
"contain.*"
"must.*"
in
ignore
be
taggedAs
thrownBy
synchronized
have
when
size
only
noneOf
oneElementOf
noElementsOf
atLeastOneElementOf
atMostOneElementOf
allElementsOf
inOrderElementsOf
theSameElementsAs
]
indentOperator.exemptScope = null
indentOperator.topLevelOnly = true
indentOperator.includeRegex = ".*"
newlines.avoidInResultType = false
newlines.neverBeforeJsNative = false
newlines.sometimesBeforeColonInMethodReturnType = true
newlines.penalizeSingleSelectMultiArgList = true
newlines.beforeCurlyLambdaParams = never
newlines.topLevelStatementBlankLines = []
newlines.topLevelStatementsMinBreaks = 1
newlines.topLevelStatements = []
newlines.beforeTemplateBodyIfBreakInParentCtors = false
newlines.topLevelBodyIfMinStatements = []
newlines.topLevelBodyMinStatements = 2
newlines.afterCurlyLambdaParams = never
newlines.implicitParamListModifierForce = []
newlines.alwaysBeforeElseAfterCurlyIf = false
newlines.forceBeforeAssign = never
newlines.alwaysBeforeMultilineDef = false
newlines.afterInfixBreakOnNested = false
newlines.afterInfixMaxCountPerExprForSome = 10
newlines.afterInfixMaxCountPerFile = 500
newlines.avoidForSimpleOverflow = []
newlines.inInterpolation = allow
newlines.ignoreInSyntax = true
newlines.avoidAfterYield = true
runner.debug = false
runner.eventCallback = "<FormatEvent => Unit>"
runner.parser = Source
runner.optimizer.dequeueOnNewStatements = true
runner.optimizer.escapeInPathologicalCases = true
runner.optimizer.maxVisitsPerToken = 10000
runner.optimizer.maxEscapes = 16
runner.optimizer.maxDepth = 100
runner.optimizer.acceptOptimalAtHints = true
runner.optimizer.disableOptimizationsInsideSensitiveAreas = true
runner.optimizer.pruneSlowStates = true
runner.optimizer.recurseOnBlocks = true
runner.optimizer.forceConfigStyleOnOffset = 150
runner.optimizer.forceConfigStyleMinArgCount = 2
runner.maxStateVisits = 1000000
runner.dialect = scala3
runner.ignoreWarnings = false
runner.fatalWarnings = false
indentYieldKeyword = true
importSelectors = noBinPack
includeCurlyBraceInSelectChains = true
includeNoParensInSelectChains = false
assumeStandardLibraryStripMargin = false
danglingParentheses.callSite = true
danglingParentheses.defnSite = true
danglingParentheses.ctrlSite = true
danglingParentheses.tupleSite = null
danglingParentheses.exclude = null
poorMansTrailingCommasInConfigStyle = false
trailingCommas = null
verticalMultiline.atDefnSite = false
verticalMultiline.arityThreshold = 100
verticalMultiline.newlineAfterOpenParen = false
verticalAlignMultilineOperators = false
onTestFailure = ""
encoding = "UTF-8"
project.git = false
project.layout = null
project.includePaths = [
"glob:**.scala"
"glob:**.sbt"
"glob:**.sc"
]
project.excludePaths = []
project.includeFilters = []
project.excludeFilters = []
xmlLiterals.assumeFormatted = false
rewrite.rules = [Imports, RedundantBraces]
rewrite.imports.expand = true
rewrite.imports.sort = original
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package ru.d10xa.jsonlogviewer

import cats.effect.IO
import cats.effect.unsafe.implicits.global
import cats.effect.IO
import cats.effect.Ref
import com.monovore.decline.Help
import com.raquo.airstream.core.Signal
import com.raquo.airstream.eventbus.EventBus
import com.raquo.airstream.ownership.Owner
import com.raquo.laminar.DomApi
import com.raquo.laminar.api.L.*
import ru.d10xa.jsonlogviewer.decline.Config
import com.raquo.laminar.DomApi
import ru.d10xa.jsonlogviewer.decline.yaml.ConfigYaml
import ru.d10xa.jsonlogviewer.decline.yaml.Feed
import ru.d10xa.jsonlogviewer.decline.Config

import scala.util.chaining.*

Expand All @@ -23,23 +24,16 @@ object ViewElement {
.pipe(DomApi.unsafeParseHtmlString)
.pipe(foreignHtmlElement)

def modifyConfigForInlineInput(string: String, config: Config): Config =
config.copy(configYaml =
Some(
ConfigYaml(
filter = None,
formatIn = None,
commands = None,
feeds = Some(
List(
Feed(
name = None,
commands = List.empty,
inlineInput = Some(string),
filter = config.filter,
formatIn = config.formatIn
)
)
def makeConfigYamlForInlineInput(string: String, config: Config): ConfigYaml =
ConfigYaml(
feeds = Some(
List(
Feed(
name = None,
commands = List.empty,
inlineInput = Some(string),
filter = config.filter,
formatIn = config.formatIn
)
)
)
Expand All @@ -54,8 +48,13 @@ object ViewElement {
.combineWith(configSignal)
.foreach {
case (string, Right(c)) =>
LogViewerStream
.stream(modifyConfigForInlineInput(string, c))
val configYamlRefIO =
Ref.of[IO, Option[ConfigYaml]](
Some(makeConfigYamlForInlineInput(string, c))
)
fs2.Stream
.eval(configYamlRefIO)
.flatMap(configYamlRef => LogViewerStream.stream(c, configYamlRef))
.compile
.toList
.map(stringsToHtmlElement)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
package ru.d10xa.jsonlogviewer.decline

import cats.effect.std.Supervisor
import cats.effect.IO
import cats.effect.Ref
import cats.effect.Resource
import ru.d10xa.jsonlogviewer.decline.yaml.ConfigYaml
import ru.d10xa.jsonlogviewer.decline.Config.FormatIn

class ConfigInitImpl extends ConfigInit {

override def initConfig(c: Config): IO[Config] = {
IO.pure(
c.copy(
formatIn = c.formatIn.orElse(Some(FormatIn.Json)),
filter = c.filter
)
)
}
override def initConfigYaml(
c: Config,
supervisor: Supervisor[IO]
): Resource[IO, Ref[IO, Option[ConfigYaml]]] =
Resource.eval(Ref.of(None))
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package ru.d10xa.jsonlogviewer

import cats.effect.*
import com.monovore.decline.Opts
import cats.effect.std.Supervisor
import com.monovore.decline.effect.CommandIOApp
import com.monovore.decline.Opts
import fs2.*
import ru.d10xa.jsonlogviewer.decline.ConfigInit
import ru.d10xa.jsonlogviewer.decline.ConfigInitImpl
Expand All @@ -16,16 +17,18 @@ object Application

private val configInit: ConfigInit = new ConfigInitImpl

def main: Opts[IO[ExitCode]] = DeclineOpts.config.map { c =>
configInit.initConfig(c).flatMap { updatedConfig =>
IO {
def main: Opts[IO[ExitCode]] = DeclineOpts.config.map { config =>
Supervisor[IO].use { supervisor =>
configInit.initConfigYaml(config, supervisor).use { configRef =>
LogViewerStream
.stream(updatedConfig)
.stream(config, configRef)
.through(text.utf8.encode)
.through(io.stdout)
.through(fs2.io.stdout)
.compile
.drain
.as(ExitCode.Success)
}.flatten
}
}


}
Loading