#!/usr/bin/env bash # Install intemp from the internet # Usage: install.sh [version] # Alt Usage: curl -o- https://raw.githubusercontent.com/karlkfi/intemp/master/install.sh | bash # Requires: curl set -o errexit set -o nounset set -o pipefail global prefix := '"/usr/local/bin'" global version := $(1:-) if test -z $(version) { global version := $[curl -s https://api.github.com/repos/karlkfi/intemp/releases/latest | grep 'tag_name' | cut -d'"' -f4] } echo "Installing intemp $(version) -> $(prefix)/intemp.sh" curl -o- "https://raw.githubusercontent.com/karlkfi/intemp/$(version)/intemp.sh" > "$(prefix)/intemp.sh" chmod a+x "$(prefix)/intemp.sh" (CommandList children: [ (C {(set)} {(-o)} {(errexit)}) (C {(set)} {(-o)} {(nounset)}) (C {(set)} {(-o)} {(pipefail)}) (Assignment keyword: Assign_None pairs: [(assign_pair lhs:(LhsName name:prefix) op:Equal rhs:{(DQ (/usr/local/bin))} spids:[36])] spids: [36] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (BracedVarSub token: suffix_op: (StringUnary op_id:VTest_ColonHyphen arg_word:{}) spids: [43 46] ) } spids: [42] ) ] spids: [42] ) (If arms: [ (if_arm cond: [ (Sentence child: (C {(Lit_Other "[")} {(-z)} {(DQ (${ VSub_Name version))} {(Lit_Other "]")}) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:version) op: Equal rhs: { (CommandSubPart command_list: (CommandList children: [ (Pipeline children: [ (C {(curl)} {(-s)} {(https) (Lit_Other ":") (//api.github.com/repos/karlkfi/intemp/releases/latest) } ) (C {(grep)} {(SQ )}) (C {(cut)} {(-d) (EscapedLiteralPart token:)} {(-f4)} ) ] negated: False ) ] ) left_token: spids: [67 92] ) } spids: [66] ) ] spids: [66] ) ] spids: [-1 63] ) ] spids: [-1 94] ) (C {(echo)} { (DQ ("Installing intemp ") (${ VSub_Name version) (" -> ") (${ VSub_Name prefix) (/intemp.sh)) } ) (SimpleCommand words: [ {(curl)} {(-o-)} { (DQ ("https://raw.githubusercontent.com/karlkfi/intemp/") (${ VSub_Name version) (/intemp.sh)) } ] redirects: [ (Redir op_id: Redir_Great fd: -1 arg_word: {(DQ (${ VSub_Name prefix) (/intemp.sh))} spids: [123] ) ] ) (C {(chmod)} {(a) (Lit_Other "+") (x)} {(DQ (${ VSub_Name prefix) (/intemp.sh))}) ] )