From: AJ ONeal Date: Tue, 14 Jul 2020 23:05:14 +0000 (+0000) Subject: add curlie X-Git-Url: https://git.josue.xyz/?p=webi-installers%2F.git;a=commitdiff_plain;h=1c66e100020683aee4989038681075ab9d35e129 add curlie --- diff --git a/curlie/README.md b/curlie/README.md new file mode 100644 index 0000000..8739aa4 --- /dev/null +++ b/curlie/README.md @@ -0,0 +1,50 @@ +--- +title: curlie +homepage: https://github.com/rs/curlie +tagline: | + curlie wraps `curl` with modern defaults and `httpie`-like syntax highlighting +--- + +## Updating + +```bash +webi curlie@stable +``` + +Use the `@beta` tag for pre-releases. + +## Cheat Sheet + +> If you like the interface of HTTPie but miss the features of curl, curlie is +> what you are searching for. Curlie is a frontend to curl that adds the ease of +> use of httpie, without compromising on features and performance. All curl +> options are exposed with syntax sugar and output formatting inspired from +> httpie. + +**Headers** (`:`) are recognized by being in the format `Key-Name:Value`. + +**JSON** (`=`) is the default encoding for `key=value` pairs. + +## Simple GET + +```bash +curlie -v example.com +``` + +## POST simple JSON with headers + +```bash +curlie -v POST httpbin.org/status/201 "Authorization: Bearer xxxx" "name=John Doe" +``` + +## POST large JSON + +```bash +curlie -v POST httpbin.org/status/201 "Authorization: Bearer xxxx" -d ' +[ + { + "name": "John Doe" + } +] +' +``` diff --git a/curlie/install.ps1 b/curlie/install.ps1 new file mode 100644 index 0000000..6360ede --- /dev/null +++ b/curlie/install.ps1 @@ -0,0 +1,44 @@ +#!/usr/bin/env pwsh + +$VERNAME = "$Env:PKG_NAME-v$Env:WEBI_VERSION.exe" +$EXENAME = "$Env:PKG_NAME.exe" +# Fetch archive +IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE")) +{ + # TODO: arch detection + echo "Downloading $Env:PKG_NAME from $Env:WEBI_PKG_URL to $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" + & curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" + & move "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE.part" "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" +} + +IF (!(Test-Path -Path "$Env:USERPROFILE\.local\xbin\$VERNAME")) +{ + echo "Installing $Env:PKG_NAME" + # TODO: temp directory + + # Enter tmp + pushd .local\tmp + + # Remove any leftover tmp cruft + Remove-Item -Path "$Env:PKG_NAME-v*" -Recurse -ErrorAction Ignore + + # Unpack archive + # Windows BSD-tar handles zip. Imagine that. + echo "Unpacking $Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" + & tar xf "$Env:USERPROFILE\Downloads\$Env:WEBI_PKG_FILE" + # Move single binary into root of temporary folder + & move "$EXENAME" "$VERNAME" + & dir + + # Settle unpacked archive into place + echo "New Name: $VERNAME" + echo "New Location: $Env:USERPROFILE\.local\xbin\$VERNAME" + Move-Item -Path "$VERNAME" -Destination "$Env:USERPROFILE\.local\xbin" + + # Exit tmp + popd +} + +echo "Copying into '$Env:USERPROFILE\.local\bin\$EXENAME' from '$Env:USERPROFILE\.local\xbin\$VERNAME'" +Remove-Item -Path "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse -ErrorAction Ignore +Copy-Item -Path "$Env:USERPROFILE\.local\xbin\$VERNAME" -Destination "$Env:USERPROFILE\.local\bin\$EXENAME" -Recurse diff --git a/curlie/install.sh b/curlie/install.sh new file mode 100644 index 0000000..a416991 --- /dev/null +++ b/curlie/install.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +{ + set -e + set -u + + ################## + # Install curlie # + ################## + + WEBI_SINGLE=true + + pkg_get_current_version() { + # 'curlie --version' has output in this format: + # curlie 0.15.4 + # This trims it down to just the version number: + # 0.15.4 + echo $(curlie --version 2>/dev/null | head -n 1 | cut -d' ' -f 2) + } + + pkg_install() { + # $HOME/.local/xbin + mkdir -p "$pkg_src_bin" + + # mv ./curlie* "$HOME/.local/opt/curlie-v0.15.4/bin/curlie" + mv ./curlie* "$pkg_src_cmd" + + # chmod a+x "$HOME/.local/xbin/rg-v11.1.0" + chmod a+x "$pkg_src_cmd" + } +} diff --git a/curlie/releases.js b/curlie/releases.js new file mode 100644 index 0000000..8ec729a --- /dev/null +++ b/curlie/releases.js @@ -0,0 +1,20 @@ +'use strict'; + +var github = require('../_common/github.js'); +var owner = 'rs'; +var repo = 'curlie'; + +module.exports = function (request) { + return github(request, owner, repo).then(function (all) { + return all; + }); +}; + +if (module === require.main) { + module.exports(require('@root/request')).then(function (all) { + all = require('../_webi/normalize.js')(all); + all.releases = all.releases.slice(0, 10); + //console.info(JSON.stringify(all)); + console.info(JSON.stringify(all, null, 2)); + }); +}