generated from axetroy/go-cli-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
72 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,13 +118,11 @@ SOURCE CODE: | |
https://github.com/whatchanged-community/whatchanged | ||
``` | ||
|
||
### Installation | ||
### Install | ||
|
||
#### Install via shell | ||
Shell(Mac/Linux) | ||
|
||
If you are using Linux/macOS. you can install it with the following command: | ||
|
||
```shell | ||
```bash | ||
# install latest version | ||
curl -fsSL https://raw.githubusercontent.com/whatchanged-community/whatchanged/master/install.sh | bash | ||
# or install specified version | ||
|
@@ -133,28 +131,24 @@ curl -fsSL https://raw.githubusercontent.com/whatchanged-community/whatchanged/m | |
curl -sf https://gobinaries.com/whatchanged-community/[email protected] | sh | ||
``` | ||
|
||
#### Install from Github release page | ||
|
||
Download the executable file for your platform at [release page](https://github.com/whatchanged-community/whatchanged/releases) and put the executable file to `$PATH` then try it. | ||
PowerShell (Windows): | ||
|
||
```bash | ||
$ whatchanged --help | ||
iwr https://github.com/whatchanged-community/whatchanged/raw/master/install.ps1 -useb | iex | ||
``` | ||
|
||
### Build from source code | ||
Github release page(All platforms) | ||
|
||
Make sure you have `[email protected]` and [goreleaser](https://github.com/goreleaser/goreleaser) installed. | ||
Download the executable file for your platform at [release page](https://github.com/whatchanged-community/whatchanged/releases) and put the executable file to `$PATH` then try the following command: | ||
|
||
```shell | ||
$ git clone https://github.com/whatchanged-community/whatchanged.git $GOPATH/src/github.com/whatchanged-community/whatchanged | ||
$ cd $GOPATH/src/github.com/whatchanged-community/whatchanged | ||
$ make build | ||
```bash | ||
$ whatchanged --help | ||
``` | ||
|
||
### Test | ||
Build and install from source using [Golang](https://golang.org): | ||
|
||
```bash | ||
$ make test | ||
go install github.com/whatchanged-community/[email protected] | ||
``` | ||
|
||
### FAQ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/usr/bin/env pwsh | ||
# inherit from https://deno.land/x/[email protected]/install.ps1 | ||
# Copyright 2018 the Deno authors. All rights reserved. MIT license. | ||
|
||
$ErrorActionPreference = 'Stop' | ||
|
||
if ($v) { | ||
$Version = "v${v}" | ||
} | ||
if ($args.Length -eq 1) { | ||
$Version = $args.Get(0) | ||
} | ||
|
||
if (Test-Path C:\Windows\SysNative) { | ||
$arch = "amd64" | ||
} else { | ||
$arch = "386" | ||
} | ||
|
||
$BinDir = "$Home\bin" | ||
$is64Bit = Test-Path C:\Windows\SysNative | ||
$WhatchangedTarGz = "$BinDir\whatchanged.tar.gz" | ||
$WhatchangedExe = "$BinDir\whatchanged.exe" | ||
$Target = "windows_$arch" | ||
|
||
# GitHub requires TLS 1.2 | ||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 | ||
|
||
$ResourceUri = if (!$Version) { | ||
"https://github.com/whatchanged-community/whatchanged/releases/latest/download/whatchanged_${Target}.tar.gz" | ||
} else { | ||
"https://github.com/whatchanged-community/whatchanged/releases/download/${Version}/whatchanged_${Target}.tar.gz" | ||
} | ||
|
||
if (!(Test-Path $BinDir)) { | ||
New-Item $BinDir -ItemType Directory | Out-Null | ||
} | ||
|
||
Invoke-WebRequest $ResourceUri -OutFile $WhatchangedTarGz -UseBasicParsing | ||
|
||
if (Get-Command Expand-Archive -ErrorAction SilentlyContinue) { | ||
Expand-Archive $WhatchangedTarGz -Destination $BinDir -Force | ||
} else { | ||
if (Test-Path $WhatchangedExe) { | ||
Remove-Item $WhatchangedExe | ||
} | ||
Add-Type -AssemblyName System.IO.Compression.FileSystem | ||
[IO.Compression.ZipFile]::ExtractToDirectory($WhatchangedTarGz, $BinDir) | ||
} | ||
|
||
Remove-Item $WhatchangedTarGz | ||
|
||
$User = [EnvironmentVariableTarget]::User | ||
$Path = [Environment]::GetEnvironmentVariable('Path', $User) | ||
if (!(";$Path;".ToLower() -like "*;$BinDir;*".ToLower())) { | ||
[Environment]::SetEnvironmentVariable('Path', "$Path;$BinDir", $User) | ||
$Env:Path += ";$BinDir" | ||
} | ||
|
||
Write-Output "Whatchanged was installed successfully to $WhatchangedExe" | ||
Write-Output "Run 'whatchanged --help' to get started" |