-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Upgrade to Go 1.16 - Build binary for Apple Silicon - Change package path from `github.com/wabarc/archive.is/pkg` to `github.com/wabarc/archive.is` - Minor improvements - Do not redirect for wayback - Add playback func to search archived URLs - Add more tests
- Loading branch information
Showing
16 changed files
with
498 additions
and
363 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
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
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,54 @@ | ||
package main | ||
|
||
import ( | ||
"flag" | ||
"fmt" | ||
"os" | ||
|
||
"github.com/wabarc/archive.is" | ||
) | ||
|
||
func main() { | ||
var ( | ||
playback bool | ||
version bool | ||
) | ||
|
||
const playbackHelp = "Search archived URL" | ||
const versionHelp = "Show version" | ||
|
||
flag.BoolVar(&playback, "playback", false, playbackHelp) | ||
flag.BoolVar(&playback, "p", false, playbackHelp) | ||
flag.BoolVar(&version, "version", false, versionHelp) | ||
flag.BoolVar(&version, "v", false, versionHelp) | ||
flag.Parse() | ||
|
||
if version { | ||
fmt.Println(is.Version) | ||
os.Exit(0) | ||
} | ||
|
||
args := flag.Args() | ||
if len(args) < 1 { | ||
flag.Usage() | ||
e := os.Args[0] | ||
fmt.Printf(" %s url [url]\n\n", e) | ||
fmt.Printf("example:\n %s https://example.com https://example.org\n\n", e) | ||
os.Exit(1) | ||
} | ||
|
||
wbrc := &is.Archiver{} | ||
|
||
if playback { | ||
collects, _ := wbrc.Playback(args) | ||
for orig, dest := range collects { | ||
fmt.Println(orig, "=>", dest) | ||
} | ||
os.Exit(0) | ||
} | ||
|
||
saved, _ := wbrc.Wayback(args) | ||
for orig, dest := range saved { | ||
fmt.Println(orig, "=>", dest) | ||
} | ||
} |
File renamed without changes.
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
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
Oops, something went wrong.