dependency-watch icon indicating copy to clipboard operation
dependency-watch copied to clipboard

Need of visual feedback it's doing stuff.

Open oldergod opened this issue 4 years ago • 2 comments

With the --watch option, the things can hang for many minutes and as anxious as I am, I'd be relieved if it could take one more line saying when the last check happen.

Right now I have

$ dependency-watch notify --watch --data watched-deps deps-watch.toml
# nothing forever

Need

$ dependency-watch notify --watch --data watched-deps deps-watch.toml
Last checked at 2022-02-17 14:05:23

With this "last checked" row refreshing itself.

oldergod avatar Feb 17 '22 19:02 oldergod

Yes, good idea.

JakeWharton avatar Feb 17 '22 19:02 JakeWharton

I can do something quick like

index 6a298c5..5ae5d47 100644
--- src/main/kotlin/watch/dependency/dependencyAwait.kt
+++ src/main/kotlin/watch/dependency/dependencyAwait.kt
 class DependencyAwait(
        private val mavenRepository: MavenRepository,
@@ -23,10 +27,20 @@ class DependencyAwait(
                                break
                        }

+                       print("Last checked at ${formatter.format(Instant.now())}. Next check in ${checkInterval.inWholeSeconds} seconds.\r")
+
                        debug.log { "Sleeping $checkInterval..." }
       delay(checkInterval)
                }

+               println("Metadata fetched at ${formatter.format(Instant.now())}")
+
                versionNotifier.notify(mavenRepository.name, coordinate, version)
        }
+
+       companion object {
+               private val formatter by lazy(NONE) {
+                       DateTimeFormatter.ofPattern("HH:mm:ss").withZone(ZoneId.systemDefault())
+               }
+       }
 }

Would you rather have another method in VersionNotifier, or another notifier ?

oldergod avatar Feb 19 '22 20:02 oldergod

Let's get it done Jake. We need this feature!

oldergod avatar Sep 14 '23 11:09 oldergod