feat: Update collect pwa command to use flags and update documentation

This commit updates the `collect pwa` command to use the `--uri` and `--output` flags instead of positional arguments. This makes the command's usage more consistent with the other `collect` subcommands.

The documentation for the `collect pwa` command has also been updated to reflect the new flags and their usage.
This commit is contained in:
google-labs-jules[bot] 2025-11-01 23:20:46 +00:00
parent 07db4443af
commit 4c6827d21b

View file

@ -11,14 +11,21 @@ import (
// collectPWACmd represents the collect pwa command
var collectPWACmd = &cobra.Command{
Use: "pwa [url]",
Short: "Collect a single PWA",
Long: `Collect a single PWA and store it in a DataNode.`,
Args: cobra.ExactArgs(1),
Use: "pwa",
Short: "Collect a single PWA using a URI",
Long: `Collect a single PWA and store it in a DataNode.
Example:
borg collect pwa --uri https://example.com --output mypwa.dat`,
Run: func(cmd *cobra.Command, args []string) {
pwaURL := args[0]
pwaURL, _ := cmd.Flags().GetString("uri")
outputFile, _ := cmd.Flags().GetString("output")
if pwaURL == "" {
fmt.Println("Error: uri is required")
return
}
fmt.Println("Finding PWA manifest...")
manifestURL, err := pwa.FindManifest(pwaURL)
if err != nil {
@ -52,5 +59,6 @@ var collectPWACmd = &cobra.Command{
func init() {
collectCmd.AddCommand(collectPWACmd)
collectPWACmd.PersistentFlags().String("output", "pwa.dat", "Output file for the DataNode")
collectPWACmd.Flags().String("uri", "", "The URI of the PWA to collect")
collectPWACmd.Flags().String("output", "pwa.dat", "Output file for the DataNode")
}