fix(cli): clarify edit --from help; test edit --from validation
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -91,7 +91,7 @@ func runAccount(args []string, role store.Role, out, errOut io.Writer) int {
|
|||||||
smtpSec := fs.String("smtp-security", "", "tls|starttls")
|
smtpSec := fs.String("smtp-security", "", "tls|starttls")
|
||||||
user := fs.String("username", "", "login username")
|
user := fs.String("username", "", "login username")
|
||||||
pass := fs.String("password", "", "login password (blank keeps existing)")
|
pass := fs.String("password", "", "login password (blank keeps existing)")
|
||||||
from := fs.String("from", "", "send-as address (blank keeps existing)")
|
from := fs.String("from", "", "send-as address (empty reverts to username)")
|
||||||
subj := fs.String("subject-regex", "", "inbound subject filter")
|
subj := fs.String("subject-regex", "", "inbound subject filter")
|
||||||
if err := fs.Parse(rest); err != nil {
|
if err := fs.Parse(rest); err != nil {
|
||||||
return 2
|
return 2
|
||||||
|
|||||||
@@ -132,3 +132,17 @@ func TestAuditListCoreRenders(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestAccountEditFromValidationRejectsMailformed(t *testing.T) {
|
||||||
|
adminEnv(t)
|
||||||
|
// Seed an account so the failure is from --from validation, not a missing account.
|
||||||
|
run(t, "account", "add", "--name", "valacc", "--imap-host", "imap.x.com", "--username", "u@x.com")
|
||||||
|
// A malformed --from value must be rejected with exit code 2 before touching the account.
|
||||||
|
code, _, errStr := run(t, "account", "edit", "--name", "valacc", "--from", "not an address")
|
||||||
|
if code != 2 {
|
||||||
|
t.Fatalf("expected exit code 2 for malformed --from, got %d (stderr: %q)", code, errStr)
|
||||||
|
}
|
||||||
|
if errStr == "" {
|
||||||
|
t.Fatal("expected an error message on stderr for malformed --from, got none")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user