Daniel Voipan 5 лет назад
Родитель
Сommit
ab87763df7
1 измененных файлов с 24 добавлено и 0 удалено
  1. 24 0
      BlackTools/BT.Core.tcl

+ 24 - 0
BlackTools/BT.Core.tcl

@@ -2211,6 +2211,30 @@ if {[string equal -nocase $user $read_user]} {
     file rename -force $temp $black(alias_file)
 }
 
+proc alias:change:update {user newuser} {
+	global black
+	set file [open $black(alias_file) "r"]
+	set timestamp [clock format [clock seconds] -format {%Y%m%d%H%M%S}]
+	set temp "$black(tempdir)/alias_temp.$timestamp"
+	set tempwrite [open $temp w]
+	set arguments ""
+while {[gets $file line] != -1} {
+	set read_user [lindex [split $line] 0]
+if {[string equal -nocase $user $read_user]} {
+	set arguments [lrange [split $line] 1 end]
+	continue
+	} else {
+		puts $tempwrite $line
+		}
+	}
+if {$arguments != ""} {
+	puts $tempwrite "$newuser $arguments"
+}
+	close $tempwrite
+	close $file
+    file rename -force $temp $black(alias_file)
+}
+
 ########################## Strip codes ###########################
 
 proc strip:all {str} {