Skip to content

Commit

Permalink
remove deprecated --switch: bool (#55)
Browse files Browse the repository at this point in the history
related to
- nushell/nushell#11365
- amtoine/nu-git-manager#154

## description
this PR will suppress the deprecation warning from
nushell/nushell#11365 which is deprecating `:
bool` annotations for switches.

this didn't break anything but did show a bunch of spurious deprecation
warnings in CI for instance:
https://github.com/amtoine/nu-git-manager/actions/runs/7307569422/job/19913395508#step:6:17
  • Loading branch information
amtoine authored Dec 23, 2023
1 parent bf17351 commit e46e2a9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions nupm/install.nu
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def open-package-file [dir: path] {
def install-scripts [
pkg_dir: path # Package directory
scripts_dir: path # Target directory where to install
--force(-f): bool # Overwrite already installed scripts
--force(-f) # Overwrite already installed scripts
]: list<path> -> nothing {
each {|script|
let src_path = $pkg_dir | path join $script
Expand Down Expand Up @@ -64,7 +64,7 @@ def install-scripts [
# Install package from a directory containing 'project.nuon'
def install-path [
pkg_dir: path # Directory (hopefully) containing 'nupm.nuon'
--force(-f): bool # Overwrite already installed package
--force(-f) # Overwrite already installed package
] {
let pkg_dir = $pkg_dir | path expand

Expand Down Expand Up @@ -103,15 +103,15 @@ def install-path [
log debug $"installing scripts for package ($package.name)"

$package.scripts
| install-scripts $pkg_dir (script-dir --ensure) --force $force
| install-scripts $pkg_dir (script-dir --ensure) --force=$force
}
},
"script" => {
log debug $"installing scripts for package ($package.name)"

[ ($pkg_dir | path join $"($package.name).nu") ]
| append ($package.scripts? | default [])
| install-scripts $pkg_dir (script-dir --ensure) --force $force
| install-scripts $pkg_dir (script-dir --ensure) --force=$force
},
"custom" => {
let build_file = $pkg_dir | path join "build.nu"
Expand Down Expand Up @@ -151,13 +151,13 @@ export def main [
--force(-f) # Overwrite already installed package
--no-confirm # Allows to bypass the interactive confirmation, useful for scripting
]: nothing -> nothing {
if not (nupm-home-prompt --no-confirm $no_confirm) {
if not (nupm-home-prompt --no-confirm=$no_confirm) {
return
}

if not $path {
throw-error "missing_required_option" "`nupm install` currently requires a `--path` flag"
}

install-path $package --force $force
install-path $package --force=$force
}
2 changes: 1 addition & 1 deletion nupm/mod.nu
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export-env {

# Nushell Package Manager
export def main []: nothing -> nothing {
nupm-home-prompt --no-confirm false
nupm-home-prompt --no-confirm=false

print 'enjoy nupm!'
}
2 changes: 1 addition & 1 deletion nupm/utils/dirs.nu
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export const DEFAULT_NUPM_TEMP = ($nu.temp-path | path join "nupm")
# Prompt to create $env.NUPM_HOME if it does not exist and some sanity checks.
#
# returns true if the root directory exists or has been created, false otherwise
export def nupm-home-prompt [--no-confirm: bool]: nothing -> bool {
export def nupm-home-prompt [--no-confirm]: nothing -> bool {
if 'NUPM_HOME' not-in $env {
error make --unspanned {
msg: "Internal error: NUPM_HOME environment variable is not set"
Expand Down

0 comments on commit e46e2a9

Please sign in to comment.