@@ -154,7 +154,7 @@ public class Main : GLib.Object{
154154 public bool cmd_verbose = true ;
155155 public bool cmd_scripted = false ;
156156 public string cmd_comments = " " ;
157- public string cmd_tags = " " ;
157+ public Tags cmd_tags = 0 ;
158158 public bool ? cmd_btrfs_mode = null ;
159159
160160 public string progress_text = " " ;
@@ -1709,7 +1709,7 @@ public class Main : GLib.Object{
17091709 snapshot_path, dt_created, sys_uuid, current_distro. full_name(),
17101710 initial_tags, cmd_comments, fcount, false , false , repo);
17111711
1712- set_tags( snapshot); // set_tags () will update the control file
1712+ snapshot. add_tag( App . cmd_tags, true ); // add_tag () may update the control file
17131713
17141714 // Perform any post-backup actions
17151715 this . run_post_backup_hooks(snapshot_path);
@@ -1802,7 +1802,7 @@ public class Main : GLib.Object{
18021802 }
18031803 snapshot. update_control_file(); // save subvolume info
18041804
1805- set_tags( snapshot); // set_tags () will update the control file
1805+ snapshot. add_tag( App . cmd_tags, true ); // add_tag () may update the control file
18061806
18071807 // Perform any post-backup actions
18081808 this . run_post_backup_hooks(snapshot_path);
@@ -1826,30 +1826,16 @@ public class Main : GLib.Object{
18261826 }
18271827 }
18281828
1829- private void set_tags (Snapshot snapshot ){
1830-
1831- // add tags passed on commandline for both --check and --create
1832-
1833- foreach (string tag in cmd_tags. split(" ," )){
1834- Tags ? parsed = Tags . parse(tag);
1835- if (parsed != null ) {
1836- snapshot. add_tag(parsed);
1837- }
1838- }
1839-
1840- // add tag as ondemand if no other tag is specified
1841-
1842- if (snapshot. tags == 0 ){
1843- snapshot. add_tag(Tags . OnDemand );
1844- }
1845- }
1846-
1847- public void validate_cmd_tags (){
1848- foreach (string tag in cmd_tags. split(" ," )){
1849- if (Tags . parse(tag) == null ) {
1829+ public void parse_cmd_tags (string input_tags ){
1830+ App . cmd_tags = 0 ;
1831+ foreach (string tag in input_tags. split(" ," )){
1832+ Tags ? parsed_tag = Tags . parse(tag);
1833+ if (parsed_tag == null ) {
18501834 log_error(_(" Unknown value specified for option --tags" ) + " (%s )." . printf(tag));
18511835 log_error(_(" Expected values: O, B, H, D, W, M" ));
18521836 exit_app(1 );
1837+ } else {
1838+ App . cmd_tags |= parsed_tag;
18531839 }
18541840 }
18551841 }
0 commit comments