Commits: 3
Rename devlog.nu to excavate
A simple verb without the .nu extension. Nice.
similarity index 100%
rename from devlog.nu
rename to excavateindex 209b098..658718a 100644
--- a/spec/BASIC.md
+++ b/spec/BASIC.md
@@ -2,7 +2,7 @@
=interpreter: nu --stdin spec/interpreters/basic.nu
=---
=
-# The Dev Log Excavator
+# The Devlog Excavator
=
=This program excavates a devlog (i.e. a bunch of .md files) from commit messages in multiple repositories.
=
@@ -122,9 +122,7 @@ TODO: Setup a second project.
=
= Leave the repository and go back to where the config file is.
=
- * Run the `devlog.nu --projects-dir . --dry-run` command
-
- TODO: Make it `devlog list`, without the extension,
+ * Run the `excavate --projects-dir . --dry-run` command
=
= * Expect the output to contain `the header row`
=
@@ -166,7 +164,7 @@ When using `--dry-run` it might be useful to see the commits grouped by project
=With `--since` and `--until` flags you can select a span of time from which commits are excavated.
=
=
-## The `excavate` Subcommand
+## The `excavate` command
=
=For each day run `git log` in each project. If there is any output, dump it to `devlog/<date>/<project-name>.md`. So each file should contain a log from a single project that was developed on a given day.
=The program will warn on activity in unlisted projects
Maybe the user would like to include them? Otherwise they should be ignored. BTW, the ignore flag doesn't do anything yet. It's a regression. Let's fix that!
index 0b8fa4c..14d0d03 100755
--- a/excavate
+++ b/excavate
@@ -46,6 +46,7 @@ export def main [
= }
= }
=
+ # The main pipeline:
= $projects_dir
= | project list
= | each $extract_log
@@ -67,6 +68,14 @@ export def main [
=
= log info $"Excavated ($stats.commits) commits from ($stats.projects) projects across ($stats.days) days"
=
+ # Warn about unlisted projects
+ $commits
+ | where { is-empty project }
+ | select path day
+ | sort-by day --reverse
+ | uniq-by path
+ | each { log warning $"Activity in an unlisted project on ($in.day): ($in.path)" }
+
= if $dry_run {
= $commits
= | update time { format date } # For the output, format dateDo not format time if running as a Nushell command
I mostly use excavate as a command in Nushell, so I'd rather has the
time column as a proper datetime. But if running as a script, it
would get converted to a humanized string, like "Yesterday" or "6 years
ago". This is not very useful. So previously the date was always
formatted into a string. But now I found a way to have it as a datetime
value when running in Nushell and as a string otherwise.
index 14d0d03..8a37e16 100755
--- a/excavate
+++ b/excavate
@@ -1,4 +1,4 @@
-#!/usr/bin/env nu
+#!/usr/bin/env -S running_as_a_script=true nu
=
=use std/log
=
@@ -78,7 +78,8 @@ export def main [
=
= if $dry_run {
= $commits
- | update time { format date } # For the output, format date
+ # If not running as a Nushell command, format time in the output
+ | if running_as_a_script in $env { update time { format date } } else { $in }
= | return $in
= }
=