new action: DeleteLines (#4)

Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
Hadi
2025-09-24 20:57:47 +02:00
parent f595823fd2
commit 7ee82425c2
3 changed files with 225 additions and 0 deletions

View File

@@ -31,6 +31,8 @@ func main() {
"csvToParquet",
// Misc
"mergeFiles",
"deleteFirstLines",
"deleteLastLines",
"removeUrlSchemeFromUlp",
}
@@ -124,6 +126,42 @@ func main() {
log.Fatal("Failed to merge files", "error", err)
}
return
case "deleteFirstLines":
var inputFile *string = flag.StringP("input", "i", "", "Input file")
var outputFile *string = flag.StringP("output", "o", "", "Output file")
var noColors *bool = flag.Bool("no-colors", false, "Remove all colors")
var debug *bool = flag.Bool("debug", false, "Debug mode")
flag.Parse()
if *inputFile == "" || *outputFile == "" {
log.Fatal("Input and output files are required")
}
if *noColors {
settings.DisableColors()
}
lu.Debug = *debug
err := misc.DeleteFirstLines(lu, *inputFile, *outputFile, 30)
if err != nil {
log.Fatal("Failed to remove first lines", "error", err)
}
return
case "deleteLastLines":
var inputFile *string = flag.StringP("input", "i", "", "Input file")
var outputFile *string = flag.StringP("output", "o", "", "Output file")
var noColors *bool = flag.Bool("no-colors", false, "Remove all colors")
var debug *bool = flag.Bool("debug", false, "Debug mode")
flag.Parse()
if *inputFile == "" || *outputFile == "" {
log.Fatal("Input and output files are required")
}
if *noColors {
settings.DisableColors()
}
lu.Debug = *debug
err := misc.DeleteLastLines(lu, *inputFile, *outputFile, 30)
if err != nil {
log.Fatal("Failed to remove last lines", "error", err)
}
return
case "removeUrlSchemeFromUlp":
var inputFile *string = flag.StringP("input", "i", "", "Input Parquet file")
var noColors *bool = flag.Bool("no-colors", false, "Remove all colors")