Skip to content

Commit 0661a8d

Browse files
committed
refactor: text progress indicator can be replaced by an actual logger
1 parent ba78918 commit 0661a8d

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

src/main/kotlin/com/coder/toolbox/cli/CoderCLIManager.kt

+2-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ fun ensureCLI(
6060
deploymentURL: URL,
6161
buildVersion: String,
6262
settings: CoderSettings,
63-
indicator: ((t: String) -> Unit)? = null,
6463
): CoderCLIManager {
6564
val cli = CoderCLIManager(deploymentURL, context.logger, settings)
6665

@@ -76,7 +75,7 @@ fun ensureCLI(
7675

7776
// If downloads are enabled download the new version.
7877
if (settings.enableDownloads) {
79-
indicator?.invoke("Downloading Coder CLI...")
78+
context.logger.info("Downloading Coder CLI...")
8079
try {
8180
cli.download()
8281
return cli
@@ -98,7 +97,7 @@ fun ensureCLI(
9897
}
9998

10099
if (settings.enableDownloads) {
101-
indicator?.invoke("Downloading Coder CLI...")
100+
context.logger.info("Downloading Coder CLI...")
102101
dataCLI.download()
103102
return dataCLI
104103
}

src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt

+4-8
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,7 @@ open class CoderProtocolHandler(
3333
* Throw if required arguments are not supplied or the workspace is not in a
3434
* connectable state.
3535
*/
36-
suspend fun handle(
37-
parameters: Map<String, String>,
38-
indicator: ((t: String) -> Unit)? = null,
39-
) {
36+
suspend fun handle(parameters: Map<String, String>) {
4037
val deploymentURL =
4138
parameters.url() ?: dialogUi.ask(
4239
context.i18n.ptrl("Deployment URL"),
@@ -121,17 +118,16 @@ open class CoderProtocolHandler(
121118
context,
122119
deploymentURL.toURL(),
123120
client.buildInfo().version,
124-
settings,
125-
indicator,
121+
settings
126122
)
127123

128124
// We only need to log in if we are using token-based auth.
129125
if (client.token != null) {
130-
indicator?.invoke("Authenticating Coder CLI...")
126+
context.logger.info("Authenticating Coder CLI...")
131127
cli.login(client.token)
132128
}
133129

134-
indicator?.invoke("Configuring Coder CLI...")
130+
context.logger.info("Configuring Coder CLI...")
135131
cli.configSsh(client.agentNames(workspaces))
136132

137133
isInitialized.waitForTrue()

src/main/kotlin/com/coder/toolbox/views/ConnectPage.kt

+1-3
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,7 @@ class ConnectPage(
101101
)
102102
client.authenticate()
103103
updateStatus(context.i18n.ptrl("Checking Coder binary..."), error = null)
104-
val cli = ensureCLI(context, client.url, client.buildVersion, settings) { status ->
105-
updateStatus(context.i18n.pnotr(status), error = null)
106-
}
104+
val cli = ensureCLI(context, client.url, client.buildVersion, settings)
107105
// We only need to log in if we are using token-based auth.
108106
if (client.token != null) {
109107
updateStatus(context.i18n.ptrl("Configuring CLI..."), error = null)

0 commit comments

Comments
 (0)