mirror of
https://github.com/sbrow/envr.git
synced 2025-12-29 15:47:38 -05:00
refactor: Renamed envr config init to envr init.
This commit is contained in:
21
mod.nu
21
mod.nu
@@ -84,7 +84,7 @@ def "close db" [] {
|
||||
rm $dec
|
||||
}
|
||||
|
||||
# Restore a .env file from backup.
|
||||
# Restore a .env file from backup
|
||||
export def "envr restore" [
|
||||
path?: path # The path of the file to restore. Will be prompted if left blank.
|
||||
]: nothing -> string {
|
||||
@@ -143,12 +143,21 @@ const available_formats = [
|
||||
]
|
||||
|
||||
# Create your initial config
|
||||
export def "envr config init" [
|
||||
export def "envr init" [
|
||||
format?: string
|
||||
#identity?: path
|
||||
] {
|
||||
mkdir ~/.envr
|
||||
|
||||
if (ls ~/.envr/config.* | length | $in > 0) {
|
||||
error make {
|
||||
msg: "A config file already exists"
|
||||
label: {
|
||||
text: "butts"
|
||||
span: (metadata $format).span
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let format = if ($format | is-empty) {
|
||||
$available_formats | input list 'Please select the desired format for your config file'
|
||||
}
|
||||
@@ -163,7 +172,9 @@ export def "envr config init" [
|
||||
priv_key: $identity
|
||||
pub_key: $'($identity).pub'
|
||||
} | tee {
|
||||
save $source
|
||||
save $source;
|
||||
open db
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +198,7 @@ export def "envr sync" [] {
|
||||
}
|
||||
|
||||
# Edit your config
|
||||
export def "envr config edit" [] {
|
||||
export def "envr edit config" [] {
|
||||
^$env.EDITOR (config-file)
|
||||
}
|
||||
|
||||
@@ -196,6 +207,6 @@ def "config-file" []: [nothing -> path nothing -> nothing] {
|
||||
}
|
||||
|
||||
# show your current config
|
||||
export def "envr config show" []: nothing -> record<source: path, priv_key: path, pub_key: path> {
|
||||
def "envr config show" []: nothing -> record<source: path, priv_key: path, pub_key: path> {
|
||||
open (config-file)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user