mirror of
https://github.com/sbrow/envr.git
synced 2026-10-25 08:41:55 -04:00
feat: Added support for remote files (via ssh).
This commit is contained in:
+12
-6
@@ -16,11 +16,18 @@ cmd_remove :: proc(cmd: ^Command) {
|
||||
return
|
||||
}
|
||||
|
||||
abs_path, abs_err := filepath.abs(path, context.temp_allocator)
|
||||
if abs_err != nil {
|
||||
fmt.wprintf(cmd.err, "Error getting absolute path: %v\n", abs_err, flush = false)
|
||||
resolved_path, _, _, is_remote, path_resolved := normalize_remote_identity(path)
|
||||
if is_remote && !path_resolved {
|
||||
return
|
||||
}
|
||||
if !is_remote {
|
||||
abs_path, abs_err := filepath.abs(path, context.temp_allocator)
|
||||
if abs_err != nil {
|
||||
fmt.wprintf(cmd.err, "Error getting absolute path: %v\n", abs_err, flush = false)
|
||||
return
|
||||
}
|
||||
resolved_path = abs_path
|
||||
}
|
||||
|
||||
db, db_ok := db_open(cmd.flags.config_file)
|
||||
if !db_ok {
|
||||
@@ -28,10 +35,9 @@ cmd_remove :: proc(cmd: ^Command) {
|
||||
}
|
||||
defer db_close(&db)
|
||||
|
||||
if !db_delete(&db, abs_path) {
|
||||
if !db_delete(&db, resolved_path) {
|
||||
return
|
||||
}
|
||||
|
||||
fmt.wprintf(cmd.out, "Removed %s from the database\n", abs_path, flush = false)
|
||||
fmt.wprintf(cmd.out, "Removed %s from the database\n", resolved_path, flush = false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user