mirror of
https://github.com/go-shiori/shiori.git
synced 2025-01-16 12:57:58 +08:00
Add flags for seeing log
This commit is contained in:
parent
0efe7eae82
commit
b1464bd89b
2 changed files with 8 additions and 2 deletions
|
@ -29,6 +29,7 @@ func addCmd() *cobra.Command {
|
|||
cmd.Flags().StringP("excerpt", "e", "", "Custom excerpt for this bookmark")
|
||||
cmd.Flags().StringSliceP("tags", "t", []string{}, "Comma-separated tags for this bookmark")
|
||||
cmd.Flags().BoolP("offline", "o", false, "Save bookmark without fetching data from internet")
|
||||
cmd.Flags().Bool("log-archival", false, "Log the archival process")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
@ -40,6 +41,7 @@ func addHandler(cmd *cobra.Command, args []string) {
|
|||
excerpt, _ := cmd.Flags().GetString("excerpt")
|
||||
tags, _ := cmd.Flags().GetStringSlice("tags")
|
||||
offline, _ := cmd.Flags().GetBool("offline")
|
||||
logArchival, _ := cmd.Flags().GetBool("log-archival")
|
||||
|
||||
// Clean up URL by removing its fragment and UTM parameters
|
||||
tmp, err := nurl.Parse(url)
|
||||
|
@ -102,6 +104,7 @@ func addHandler(cmd *cobra.Command, args []string) {
|
|||
URL: url,
|
||||
Reader: io.TeeReader(resp.Body, buffer),
|
||||
ContentType: resp.Header.Get("Content-Type"),
|
||||
LogEnabled: logArchival,
|
||||
}
|
||||
|
||||
err = warc.NewArchive(archivalRequest, archivePath)
|
||||
|
|
|
@ -41,7 +41,8 @@ func updateCmd() *cobra.Command {
|
|||
cmd.Flags().BoolP("offline", "o", false, "Update bookmark without fetching data from internet")
|
||||
cmd.Flags().BoolP("yes", "y", false, "Skip confirmation prompt and update ALL bookmarks")
|
||||
cmd.Flags().Bool("dont-overwrite", false, "Don't overwrite existing metadata. Useful when only want to update bookmark's content")
|
||||
cmd.Flags().BoolP("no-archive", "a", false, "Update bookmark without creating offline archive")
|
||||
cmd.Flags().BoolP("no-archival", "a", false, "Update bookmark without updating offline archive")
|
||||
cmd.Flags().Bool("log-archival", false, "Log the archival process")
|
||||
|
||||
return cmd
|
||||
}
|
||||
|
@ -54,7 +55,8 @@ func updateHandler(cmd *cobra.Command, args []string) {
|
|||
tags, _ := cmd.Flags().GetStringSlice("tags")
|
||||
offline, _ := cmd.Flags().GetBool("offline")
|
||||
skipConfirm, _ := cmd.Flags().GetBool("yes")
|
||||
noArchival, _ := cmd.Flags().GetBool("no-archive")
|
||||
noArchival, _ := cmd.Flags().GetBool("no-archival")
|
||||
logArchival, _ := cmd.Flags().GetBool("log-archival")
|
||||
dontOverwrite := cmd.Flags().Changed("dont-overwrite")
|
||||
|
||||
// If no arguments (i.e all bookmarks going to be updated), confirm to user
|
||||
|
@ -190,6 +192,7 @@ func updateHandler(cmd *cobra.Command, args []string) {
|
|||
URL: book.URL,
|
||||
Reader: io.TeeReader(resp.Body, buffer),
|
||||
ContentType: resp.Header.Get("Content-Type"),
|
||||
LogEnabled: logArchival,
|
||||
}
|
||||
|
||||
err = warc.NewArchive(archivalRequest, archivePath)
|
||||
|
|
Loading…
Reference in a new issue