summaryrefslogtreecommitdiff
path: root/main.v
diff options
context:
space:
mode:
authorOsCoder <oscoder@lczimmermann.eu>2026-06-13 14:17:58 +0200
committerOsCoder <oscoder@lczimmermann.eu>2026-06-13 14:17:58 +0200
commit0e2d74027f307903580a647b3a87372a39d7c40a (patch)
tree12db1f3bcce2435f8b2dffb6726ccc5a00034a1c /main.v
parent2fc45832605731240bd4636f61b0d7e66add9b05 (diff)
downloadvbackup-0e2d74027f307903580a647b3a87372a39d7c40a.tar.xz
vbackup-0e2d74027f307903580a647b3a87372a39d7c40a.zip
Added cmd flags and basic help
Diffstat (limited to 'main.v')
-rw-r--r--main.v69
1 files changed, 54 insertions, 15 deletions
diff --git a/main.v b/main.v
index 078e1d5..3ee474e 100644
--- a/main.v
+++ b/main.v
@@ -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)
}