feat: add --indent flag to control line indentation in remind output

- Introduces an 'indent' integer flag to the CLI for specifying the
  number of spaces to indent lines in the remind output.
- Updates Task.ToRemind to accept an indent parameter and apply heading
  spaces accordingly.
- Adjusts main.go to pass the indent value from the flag to ToRemind.
This commit is contained in:
2026-01-15 00:05:34 +01:00
parent 1099f4ab97
commit 5e5999676d
2 changed files with 8 additions and 4 deletions

View File

@@ -14,6 +14,7 @@ var (
inputFile string
outputFile string
debug bool
indent int
version = "v3.0.0"
)
@@ -59,7 +60,7 @@ func main() {
}
for _, t := range tasks {
rem := t.ToRemind()
rem := t.ToRemind(indent)
if rem == "" {
continue
}
@@ -71,6 +72,7 @@ func main() {
rootCmd.Flags().StringVarP(&inputFile, "input", "i", "", "Input file (default: stdin)")
rootCmd.Flags().StringVarP(&outputFile, "output", "o", "", "Output file (default: stdout)")
rootCmd.Flags().BoolVar(&debug, "debug", false, "Print intermediate JSON to stderr")
rootCmd.Flags().IntVar(&indent, "indent", 0, "Number of spaces to indent lines (from second line onward)")
rootCmd.Version = version
rootCmd.Flags().BoolP("version", "v", false, "Show version and exit")
rootCmd.SetVersionTemplate(fmt.Sprintf("todotxt2remind version %s\n", version))