summaryrefslogtreecommitdiff
path: root/main.v
blob: 3ee474e78d1f12711f96daed356421bc1b417aba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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())
	vbackup_cmd.parse(os.args)
}