diff options
Diffstat (limited to 'main.v')
| -rw-r--r-- | main.v | 69 |
1 files changed, 54 insertions, 15 deletions
@@ -2,24 +2,63 @@ module main import time import os -import os.cmdline - -struct Backup_config { - source string @[required] - destination string @[required] - keep int = 10 - incremental bool - dry_run bool - verbose bool - compression bool +import cli {Command, Flag} + +fn get_timestamp() string { + now := time.now() + return now.format_rfc3339() } fn main() { + mut vbackup_cmd := Command { + name: 'vbackup' + description: 'vbackup is a simple backup tool for Linux, relying on tar. It sprinkles some management logic on top and is designed to be used by cron or other scheduling tools.' + version: '0.0.1' + } + + vbackup_cmd.add_flag(Flag { + flag: .string + name: 'source' + description: 'The absolute path to the folder you want to recursivly backup.' + }) + + vbackup_cmd.add_flag(Flag { + flag: .string + name: 'destination' + description: 'The absolute path to the folder where the archives should be stored.' + }) + + vbackup_cmd.add_flag(Flag { + flag: .int + name: 'keep' + description: 'The number of archives, which should be kept in the destination folder' + }) + + vbackup_cmd.add_flag(Flag { + flag: .bool + name: 'incremental' + description: 'Should the newest backup be incremental to the last backup if on exists' + }) + + vbackup_cmd.add_flag(Flag { + flag: .bool + name: 'dry-run' + description: 'Should the programm only say what it will be doing, without making any changes' + }) + + vbackup_cmd.add_flag(Flag { + flag: .bool + name: 'verbose' + description: 'Should the program give you extended output about its operations' + }) + + vbackup_cmd.add_flag(Flag { + flag: .bool + name: 'compression' + description: 'Should the created backup be have compression' + }) + println('Welcome to vbackup!') println('Current timestamp: ' + get_timestamp()) -} - -fn get_timestamp() string { - now := time.now() - return now.format_rfc3339() + vbackup_cmd.parse(os.args) } |
