backup

package
v0.95.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Cmd = &cobra.Command{
	Use:   "backup <file>",
	Short: "Create a numbered backup of a file in the same directory",
	Long: `Create a backup of a file with format: .<basename>.<number>.<YYYY-mm-dd_HH-MM>.ext.backup

Example:
  slu scripts backup /etc/nginx/nginx.conf
  Creates: /etc/nginx/.nginx.1.2025-11-05_14-30.conf.backup`,
	Args: cobra.ExactArgs(1),
	Run: func(c *cobra.Command, args []string) {
		filePath := args[0]
		backupFile, err := createBackup(filePath)
		if err != nil {
			fmt.Fprintf(os.Stderr, "Error: %v\n", err)
			os.Exit(1)
		}
		fmt.Println("Backup file created:", backupFile)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL