Skip to content

Commit

Permalink
Make check pass
Browse files Browse the repository at this point in the history
  • Loading branch information
fehnomenal committed Nov 10, 2020
1 parent 363abdd commit 0b4acf5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class DirenvProjectService(private val project: Project) {
private val direnvService = service<DirenvService>()
private val envService = service<EnvironmentService>()


fun importDirenv() {
val process = executeDirenv("export", "json") ?: return

Expand Down Expand Up @@ -85,16 +84,15 @@ class DirenvProjectService(private val project: Project) {
)
}


private fun executeDirenv(vararg args: String): Process? {
envrcFile ?: return null

val command = listOf(
direnvService.direnvExecutable?.toString() ?: return null,
*args,
)
return ProcessBuilder(command)
.directory(workingDir ?: return null)
.start()
return envrcFile?.let {
workingDir?.let { workingDir ->
direnvService.direnvExecutable?.toString()?.let { executable ->
ProcessBuilder(executable, *args)
.directory(workingDir)
.start()
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,5 @@ class DirenvService {
.map { Path.of(it, "direnv") }
.firstOrNull { Files.exists(it) && Files.isExecutable(it) }


val notificationGroup = NotificationGroup.balloonGroup("Direnv")
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,8 @@ class EnvironmentService {
modifiableEnvironment[name] = value
}


class ManipulateEnvironmentException(message: String) : Throwable(message)


private val modifiableEnvironment by lazy {
val env = System.getenv()
val envClass = env.javaClass
Expand Down Expand Up @@ -43,7 +41,8 @@ class EnvironmentService {
"exception.multipleMapFields",
cls.canonicalName,
Map::class.java.canonicalName,
mapFields.map { it.name })
mapFields.map { it.name }
)
)
}

Expand Down

0 comments on commit 0b4acf5

Please sign in to comment.