Browse Source

Update account cmd and documentation

Neeraj Gupta 1 year ago
parent
commit
fd7aac9b44
5 changed files with 27 additions and 4 deletions
  1. 10 1
      README.md
  2. 7 2
      cmd/account.go
  3. 1 1
      pkg/account.go
  4. 5 0
      pkg/sync.go
  5. 4 0
      release.sh

+ 10 - 1
README.md

@@ -15,8 +15,17 @@
     ```shell
     ente-cli account list
     ```
+  
+* Change export directory
+    ```shell
+    ente-cli account update --email yourEmail@example.com --dir ~/photos 
+    ```
 
-
+## Export
+* Start export
+    ```shell
+    ente-cli export
+    ```
 
 ## Testing
 

+ 7 - 2
cmd/account.go

@@ -44,7 +44,12 @@ var updateAccCmd = &cobra.Command{
 		app, _ := cmd.Flags().GetString("app")
 		email, _ := cmd.Flags().GetString("email")
 		if email == "" {
-			fmt.Printf("email must be specified")
+			fmt.Println("email must be specified")
+			return
+		}
+		if exportDir == "" {
+			fmt.Println("dir param must be specified")
+			return
 		}
 
 		validApps := map[string]bool{
@@ -72,7 +77,7 @@ func init() {
 	// Add 'config' subcommands to the root command
 	rootCmd.AddCommand(accountCmd)
 	// Add 'config' subcommands to the 'config' command
-	updateAccCmd.Flags().String("dir", "", "Update export directory")
+	updateAccCmd.Flags().String("dir", "", "update export directory")
 	updateAccCmd.Flags().String("email", "", "email address of the account to update")
 	updateAccCmd.Flags().String("app", "photos", "Specify the app, default is 'photos'")
 	accountCmd.AddCommand(listAccCmd, addAccCmd, updateAccCmd)

+ 1 - 1
pkg/account.go

@@ -154,7 +154,7 @@ func (c *ClICtrl) UpdateAccount(ctx context.Context, params model.UpdateAccountP
 		}
 	}
 	if acc == nil {
-		return fmt.Errorf("account not found")
+		return fmt.Errorf("account not found, use `account list` to list accounts")
 	}
 	if params.ExportDir != nil && *params.ExportDir != "" {
 		_, err := internal.ValidateDirForWrite(*params.ExportDir)

+ 5 - 0
pkg/sync.go

@@ -2,6 +2,7 @@ package pkg
 
 import (
 	"cli-go/internal"
+	"cli-go/internal/api"
 	"cli-go/pkg/model"
 	"context"
 	"encoding/base64"
@@ -31,6 +32,10 @@ func (c *ClICtrl) Export() error {
 			log.Printf("Skip export, error: %v while validing exportDir %s\n", err, account.ExportDir)
 			continue
 		}
+		if account.App == api.AppAuth {
+			log.Printf("Skip account %s: auth export is not supported", account.Email)
+			continue
+		}
 		log.Println("start sync")
 		err = c.SyncAccount(account)
 		if err != nil {

+ 4 - 0
release.sh

@@ -24,6 +24,10 @@ do
     if [ "$OS" == "darwin" ]; then
         BINARY_NAME="ente-cli-mac"
     fi
+
+    if [ "$OS" == "linux" ]; then
+        BINARY_NAME="ente-cli-linux"
+    fi
     # make bin directory if it doesn't exist
     mkdir -p bin