Skip to content

Commit 28c7e09

Browse files
authored
Replace deprecated fetch with http get (nushell#530)
Applied in nushell/nushell#7796
1 parent 424e8d6 commit 28c7e09

File tree

5 files changed

+6
-6
lines changed

5 files changed

+6
-6
lines changed

sourced/cool-oneliners/dict.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ def dict [...word #word(s) to query the dictionary API but they have to make sen
33
] {
44
let query = ($word | str join %20)
55
let link = ('https://api.dictionaryapi.dev/api/v2/entries/en/' + ($query|str replace ' ' '%20'))
6-
let output = (fetch $link | rename word)
6+
let output = (http get $link | rename word)
77
let w = ($output.word | first)
88

99
if $w == "No Definitions Found" {

sourced/gitlab/gitlab.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ def call-gitlab [
77
...args: string
88
--query: string
99
] {
10-
fetch -H [Authorization $"Bearer ($env.GITLAB_TOKEN)"] $"($projects)($args|str join)?($query)"
10+
http get -H [Authorization $"Bearer ($env.GITLAB_TOKEN)"] $"($projects)($args|str join)?($query)"
1111
}
1212
# Search files on your GitLab server
1313
def main [

sourced/misc/nu_defs.nu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ def mbitly [longurl] {
310310
let username = "user"
311311
let url = $"https://api-ssl.bitly.com/v3/shorten?access_token=($Accesstoken)&login=($username)&longUrl=($longurl)"
312312

313-
let shorturl = (fetch $url | get data | get url)
313+
let shorturl = (http get $url | get data | get url)
314314

315315
$shorturl
316316
$shorturl | xclip -sel clip
@@ -345,7 +345,7 @@ def trans [
345345

346346
let url = $"https://api.mymemory.translated.net/get?q=($to_translate)&langpair=($from)%7C($to)&of=json&key=($key)&de=($user)"
347347

348-
fetch $url | get responseData | get translatedText
348+
http get $url | get responseData | get translatedText
349349
}
350350
}
351351

sourced/update_hosts.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module hosts {
2626
let whitelisted = "(" + ($WHITELIST | str join "|") + ")"
2727
let pattern = ($"0.0.0.0.*($whitelisted).*$")
2828
let OLD_FILE = "/etc/hosts"
29-
let TMP_FILE = (fetch $LINK | lines)
29+
let TMP_FILE = (http get $LINK | lines)
3030

3131
if ($env.LAST_EXIT_CODE == 0) {
3232
let OLD_HEAD = (open $OLD_FILE --raw | lines | first 8 | last 3)

sourced/webscraping/shell_stars.nu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ $shell_list | each { |r|
3535
print ""
3636
} else {
3737
let url = $"https://api.github.com/repos/($r.repo)"
38-
let count = (fetch -u $env.GITHUB_USERNAME -p $env.GITHUB_PASSWORD ($url) | get stargazers_count)
38+
let count = (http get -u $env.GITHUB_USERNAME -p $env.GITHUB_PASSWORD ($url) | get stargazers_count)
3939
print $" ($count)"
4040
[[shell repo stars]; [($r.name) ($r.repo) ($count)]]
4141
}

0 commit comments

Comments
 (0)