module main import time import os 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()) if !os.exists('/usr/bin/tar') || !os.exists('/bin/tar') { println('We could not find tar on your system, please make sure its available under /bin or /usr/bin') exit(127) } else { println('tar is available') } println('--- --- --- ---') vbackup_cmd.parse(os.args) }