Rename ente-cli to ente
This commit is contained in:
parent
b374fd23e9
commit
d3c07e0a17
8 changed files with 16 additions and 11 deletions
|
@ -5,7 +5,7 @@
|
||||||
# Feel free to remove those if you don't want/need to use them.
|
# Feel free to remove those if you don't want/need to use them.
|
||||||
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
# yaml-language-server: $schema=https://goreleaser.com/static/schema.json
|
||||||
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
# vim: set ts=2 sw=2 tw=0 fo=cnqoj
|
||||||
project_name: ente-cli
|
project_name: ente
|
||||||
before:
|
before:
|
||||||
hooks:
|
hooks:
|
||||||
# You may remove this if you don't use go modules.
|
# You may remove this if you don't use go modules.
|
||||||
|
|
|
@ -17,7 +17,7 @@ var ctrl *pkg.ClICtrl
|
||||||
|
|
||||||
// rootCmd represents the base command when called without any subcommands
|
// rootCmd represents the base command when called without any subcommands
|
||||||
var rootCmd = &cobra.Command{
|
var rootCmd = &cobra.Command{
|
||||||
Use: "ente-cli",
|
Use: "ente",
|
||||||
Short: "CLI tool for exporting your photos from ente.io",
|
Short: "CLI tool for exporting your photos from ente.io",
|
||||||
Long: `Start by creating a config file in your home directory:`,
|
Long: `Start by creating a config file in your home directory:`,
|
||||||
// Uncomment the following line if your bare application
|
// Uncomment the following line if your bare application
|
||||||
|
|
|
@ -12,7 +12,7 @@ var versionCmd = &cobra.Command{
|
||||||
Short: "Prints the current version",
|
Short: "Prints the current version",
|
||||||
Long: ``,
|
Long: ``,
|
||||||
Run: func(cmd *cobra.Command, args []string) {
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
fmt.Printf("ente-cli version %s\n", AppVersion)
|
fmt.Printf("Version %s\n", AppVersion)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
3
main.go
3
main.go
|
@ -66,8 +66,7 @@ func GetCLIConfigPath() (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create the path for the .ente-cli folder
|
cliDBPath := filepath.Join(homeDir, ".ente")
|
||||||
cliDBPath := filepath.Join(homeDir, ".ente-cli")
|
|
||||||
|
|
||||||
// Check if the folder already exists, if not, create it
|
// Check if the folder already exists, if not, create it
|
||||||
if _, err := os.Stat(cliDBPath); os.IsNotExist(err) {
|
if _, err := os.Stat(cliDBPath); os.IsNotExist(err) {
|
||||||
|
|
|
@ -73,7 +73,7 @@ func (c *ClICtrl) AddAccount(cxt context.Context) {
|
||||||
return
|
return
|
||||||
} else {
|
} else {
|
||||||
fmt.Println("Account added successfully")
|
fmt.Println("Account added successfully")
|
||||||
fmt.Println("run `ente-cli export` to initiate export of your account data")
|
fmt.Println("run `ente export` to initiate export of your account data")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ type ClICtrl struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ClICtrl) Init() error {
|
func (c *ClICtrl) Init() error {
|
||||||
tempPath := filepath.Join(os.TempDir(), "ente-cli-download")
|
tempPath := filepath.Join(os.TempDir(), "ente-download")
|
||||||
// create temp folder if not exists
|
// create temp folder if not exists
|
||||||
if _, err := os.Stat(tempPath); os.IsNotExist(err) {
|
if _, err := os.Stat(tempPath); os.IsNotExist(err) {
|
||||||
err = os.Mkdir(tempPath, 0755)
|
err = os.Mkdir(tempPath, 0755)
|
||||||
|
|
|
@ -17,9 +17,15 @@ func IsRunningInContainer() bool {
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const (
|
||||||
|
secretService = "ente"
|
||||||
|
secretUser = "ente-cli-user"
|
||||||
|
)
|
||||||
|
|
||||||
func GetOrCreateClISecret() []byte {
|
func GetOrCreateClISecret() []byte {
|
||||||
// get password
|
// get password
|
||||||
secret, err := keyring.Get("ente-cli-cli", "ghost")
|
secret, err := keyring.Get(secretService, secretUser)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if !errors.Is(err, keyring.ErrNotFound) {
|
if !errors.Is(err, keyring.ErrNotFound) {
|
||||||
if IsRunningInContainer() {
|
if IsRunningInContainer() {
|
||||||
|
@ -34,7 +40,7 @@ func GetOrCreateClISecret() []byte {
|
||||||
log.Fatal(fmt.Errorf("error generating key: %w", err))
|
log.Fatal(fmt.Errorf("error generating key: %w", err))
|
||||||
}
|
}
|
||||||
secret = string(key)
|
secret = string(key)
|
||||||
keySetErr := keyring.Set("ente-cli-cli", "ghost", string(secret))
|
keySetErr := keyring.Set(secretService, secretUser, string(secret))
|
||||||
if keySetErr != nil {
|
if keySetErr != nil {
|
||||||
log.Fatal(fmt.Errorf("error setting password in keyring: %w", keySetErr))
|
log.Fatal(fmt.Errorf("error setting password in keyring: %w", keySetErr))
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,11 +20,11 @@ do
|
||||||
export GOARCH="$ARCH"
|
export GOARCH="$ARCH"
|
||||||
|
|
||||||
# Set the output binary name to "ente-cli" for the current OS and architecture
|
# Set the output binary name to "ente-cli" for the current OS and architecture
|
||||||
BINARY_NAME="ente-cli-$OS-$ARCH"
|
BINARY_NAME="ente-$OS-$ARCH"
|
||||||
|
|
||||||
# Add .exe extension for Windows
|
# Add .exe extension for Windows
|
||||||
if [ "$OS" == "windows" ]; then
|
if [ "$OS" == "windows" ]; then
|
||||||
BINARY_NAME="ente-cli-$OS-$ARCH.exe"
|
BINARY_NAME="ente-$OS-$ARCH.exe"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build the binary and place it in the "bin" directory
|
# Build the binary and place it in the "bin" directory
|
||||||
|
|
Loading…
Reference in a new issue