fix: break long lines to respect 120 character limit (lll)
Break long lines in function signatures and strings to comply with the 120 character line length limit by using multi-line formatting and extracting variables where appropriate. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
f569bc55ea
commit
f868e94069
@ -28,7 +28,8 @@ func newGenerateMnemonicCmd() *cobra.Command {
|
|||||||
return &cobra.Command{
|
return &cobra.Command{
|
||||||
Use: "mnemonic",
|
Use: "mnemonic",
|
||||||
Short: "Generate a random BIP39 mnemonic phrase",
|
Short: "Generate a random BIP39 mnemonic phrase",
|
||||||
Long: `Generate a cryptographically secure random BIP39 mnemonic phrase that can be used with 'secret init' or 'secret import'.`,
|
Long: `Generate a cryptographically secure random BIP39 mnemonic phrase that can be used with ` +
|
||||||
|
`'secret init' or 'secret import'.`,
|
||||||
RunE: func(cmd *cobra.Command, args []string) error {
|
RunE: func(cmd *cobra.Command, args []string) error {
|
||||||
cli := NewCLIInstance()
|
cli := NewCLIInstance()
|
||||||
return cli.GenerateMnemonic(cmd)
|
return cli.GenerateMnemonic(cmd)
|
||||||
@ -92,7 +93,9 @@ func (cli *Instance) GenerateMnemonic(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GenerateSecret generates a random secret and stores it in the vault
|
// GenerateSecret generates a random secret and stores it in the vault
|
||||||
func (cli *Instance) GenerateSecret(cmd *cobra.Command, secretName string, length int, secretType string, force bool) error {
|
func (cli *Instance) GenerateSecret(
|
||||||
|
cmd *cobra.Command, secretName string, length int, secretType string, force bool,
|
||||||
|
) error {
|
||||||
if length < 1 {
|
if length < 1 {
|
||||||
return fmt.Errorf("length must be at least 1")
|
return fmt.Errorf("length must be at least 1")
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,8 @@ func (cli *Instance) Init(cmd *cobra.Command) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Write encrypted long-term private key
|
// Write encrypted long-term private key
|
||||||
if err := afero.WriteFile(cli.fs, filepath.Join(unlockerDir, "longterm.age"), encryptedLtPrivKey, secret.FilePerms); err != nil {
|
ltPrivKeyPath := filepath.Join(unlockerDir, "longterm.age")
|
||||||
|
if err := afero.WriteFile(cli.fs, ltPrivKeyPath, encryptedLtPrivKey, secret.FilePerms); err != nil {
|
||||||
return fmt.Errorf("failed to write encrypted long-term private key: %w", err)
|
return fmt.Errorf("failed to write encrypted long-term private key: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,7 +34,8 @@ import (
|
|||||||
// Helper function to set up a vault with long-term key
|
// Helper function to set up a vault with long-term key
|
||||||
func setupTestVault(t *testing.T, fs afero.Fs, stateDir string) {
|
func setupTestVault(t *testing.T, fs afero.Fs, stateDir string) {
|
||||||
// Set mnemonic for testing
|
// Set mnemonic for testing
|
||||||
t.Setenv(secret.EnvMnemonic, "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about")
|
testMnemonic := "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about"
|
||||||
|
t.Setenv(secret.EnvMnemonic, testMnemonic)
|
||||||
|
|
||||||
// Create vault
|
// Create vault
|
||||||
vlt, err := vault.CreateVault(fs, stateDir, "default")
|
vlt, err := vault.CreateVault(fs, stateDir, "default")
|
||||||
|
Loading…
Reference in New Issue
Block a user