-
Notifications
You must be signed in to change notification settings - Fork 1
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.org/pkg` to `github.com/wabarc/archive.org` - Minor improvements - Do not redirect for wayback - Add playback func to search archived URLs - Add more tests
- Loading branch information
Showing
15 changed files
with
375 additions
and
281 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.org" | ||
) | ||
|
||
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(ia.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 := &ia.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
github.com/wabarc/helper v0.0.0-20210127120855-10af37cc2616 h1:wZ5HtpmZAVUq0Im5Sm92ycJrTeLJk5lB/Kvh55Rd+Ps= | ||
github.com/wabarc/helper v0.0.0-20210127120855-10af37cc2616/go.mod h1:N9P4r7Rn46p4nkWtXV6ztN3p5ACVnp++bgfwjTqSxQ8= | ||
github.com/wabarc/logger v0.0.0-20210417045349-d0d82e8e99ee h1:MMIp++7eem2CI1jIYDoPByMwXeZAjsFo2ciBNtvhB80= | ||
github.com/wabarc/logger v0.0.0-20210417045349-d0d82e8e99ee/go.mod h1:4uYr9fnQaQoDk1ttTzLnSB3lZm3i/vrJwN8EZIB2YuI= |
Oops, something went wrong.