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:
4
main.go
4
main.go
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user