Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Cmd = &cobra.Command{ Use: "replace-string", Short: "Replace string in file (like sed)", Aliases: []string{"rs"}, Args: cobra.NoArgs, Run: func(c *cobra.Command, args []string) { inputBytes, err := os.ReadFile(FlagInputFilePath) if err != nil { log.Fatalln(err) } input := string(inputBytes) output := strings.Replace(input, FlagFindString, FlagReplacementString, -1) if FlagOutputFilePath == "" { fmt.Println(output) } else { err = os.WriteFile(FlagOutputFilePath, []byte(output), 0644) if err != nil { log.Fatalln(err) } } }, }
View Source
var FlagFindString string
View Source
var FlagInputFilePath string
View Source
var FlagOutputFilePath string
View Source
var FlagReplacementString string
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.