mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 10:38:33 -04:00
style: Removed unused code.
This commit is contained in:
@@ -3,47 +3,47 @@ package main
|
||||
import "core:fmt"
|
||||
import "core:os"
|
||||
import "core:path/filepath"
|
||||
import "core:strings"
|
||||
|
||||
cmd_edit_config :: proc(cmd: ^Command) {
|
||||
editor := os.get_env("EDITOR", context.allocator)
|
||||
if len(editor) == 0 {
|
||||
fmt.println("Error: $EDITOR environment variable is not set")
|
||||
return
|
||||
}
|
||||
editor := os.get_env("EDITOR", context.allocator)
|
||||
if len(editor) == 0 {
|
||||
fmt.println("Error: $EDITOR environment variable is not set")
|
||||
return
|
||||
}
|
||||
|
||||
config_path, join_err := filepath.join([]string{envr_dir(), "config.json"})
|
||||
if join_err != nil {
|
||||
fmt.printf("Error building config path: %v\n", join_err)
|
||||
return
|
||||
}
|
||||
config_path, join_err := filepath.join([]string{envr_dir(), "config.json"})
|
||||
if join_err != nil {
|
||||
fmt.printf("Error building config path: %v\n", join_err)
|
||||
return
|
||||
}
|
||||
|
||||
_, stat_err := os.stat(config_path, context.allocator)
|
||||
if stat_err != nil {
|
||||
fmt.printf("Config file does not exist at %s. Run 'envr init' first.\n", config_path)
|
||||
return
|
||||
}
|
||||
_, stat_err := os.stat(config_path, context.allocator)
|
||||
if stat_err != nil {
|
||||
fmt.printf("Config file does not exist at %s. Run 'envr init' first.\n", config_path)
|
||||
return
|
||||
}
|
||||
|
||||
args := []string{editor, config_path}
|
||||
desc := os.Process_Desc{
|
||||
command = args,
|
||||
stdin = os.stdin,
|
||||
stdout = os.stdout,
|
||||
stderr = os.stderr,
|
||||
}
|
||||
args := []string{editor, config_path}
|
||||
desc := os.Process_Desc {
|
||||
command = args,
|
||||
stdin = os.stdin,
|
||||
stdout = os.stdout,
|
||||
stderr = os.stderr,
|
||||
}
|
||||
|
||||
p, start_err := os.process_start(desc)
|
||||
if start_err != nil {
|
||||
fmt.printf("Error running editor: %v\n", start_err)
|
||||
return
|
||||
}
|
||||
p, start_err := os.process_start(desc)
|
||||
if start_err != nil {
|
||||
fmt.printf("Error running editor: %v\n", start_err)
|
||||
return
|
||||
}
|
||||
|
||||
state, wait_err := os.process_wait(p)
|
||||
if wait_err != nil {
|
||||
fmt.printf("Error waiting for editor: %v\n", wait_err)
|
||||
return
|
||||
}
|
||||
if state.exit_code != 0 {
|
||||
os.exit(int(state.exit_code))
|
||||
}
|
||||
state, wait_err := os.process_wait(p)
|
||||
if wait_err != nil {
|
||||
fmt.printf("Error waiting for editor: %v\n", wait_err)
|
||||
return
|
||||
}
|
||||
if state.exit_code != 0 {
|
||||
os.exit(int(state.exit_code))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user