RawCommandArg (shared/raw.rs)

himalaya · src/shared/raw.rs · rust · Apache-2.0
email

Parses raw protocol commands from CLI arguments or stdin, normalizing line endings.

// Source: https://github.com/pimalaya/himalaya | License: Apache-2.0 | Copyright 2022-2026 soywod <pimalaya.org@posteo.net>
// Provided via justclaw.it.com; keep this notice with the code.
//! # Raw command
//!
//! The clap argument the raw IMAP, SMTP and ManageSieve commands take
//! their input from.
//!
//! A command typed on the shell arrives with its backslash escapes
//! literal, so `\r` and `\n` are turned into real CRLF here and a whole
//! batch of commands can be passed inline.
//!
//! The trailing CRLF is each caller's policy: IMAP appends one when
//! missing, io-imap rejecting an unterminated command, where SMTP strips
//! it, io-smtp appending its own, and forbids batching.

use std::io::{IsTerminal, Read, stdin};

use anyhow::{Context, bail};
use clap::Parser;

use crate::s

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key