mirror of
https://github.com/sbrow/envr.git
synced 2025-12-29 23:47:39 -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
|
rm $dec
|
||||||
}
|
}
|
||||||
|
|
||||||
# Restore a .env file from backup.
|
# Restore a .env file from backup
|
||||||
export def "envr restore" [
|
export def "envr restore" [
|
||||||
path?: path # The path of the file to restore. Will be prompted if left blank.
|
path?: path # The path of the file to restore. Will be prompted if left blank.
|
||||||
]: nothing -> string {
|
]: nothing -> string {
|
||||||
@@ -143,12 +143,21 @@ const available_formats = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
# Create your initial config
|
# Create your initial config
|
||||||
export def "envr config init" [
|
export def "envr init" [
|
||||||
format?: string
|
format?: string
|
||||||
#identity?: path
|
#identity?: path
|
||||||
] {
|
] {
|
||||||
mkdir ~/.envr
|
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) {
|
let format = if ($format | is-empty) {
|
||||||
$available_formats | input list 'Please select the desired format for your config file'
|
$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
|
priv_key: $identity
|
||||||
pub_key: $'($identity).pub'
|
pub_key: $'($identity).pub'
|
||||||
} | tee {
|
} | tee {
|
||||||
save $source
|
save $source;
|
||||||
|
open db
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +198,7 @@ export def "envr sync" [] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# Edit your config
|
# Edit your config
|
||||||
export def "envr config edit" [] {
|
export def "envr edit config" [] {
|
||||||
^$env.EDITOR (config-file)
|
^$env.EDITOR (config-file)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,6 +207,6 @@ def "config-file" []: [nothing -> path nothing -> nothing] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
# show your current config
|
# 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)
|
open (config-file)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user