Rename _cmd options to _command for consistency
parent
839d2f3d80
commit
899d497c9c
4
meli.1
4
meli.1
|
@ -213,7 +213,7 @@ At any time you may press
|
||||||
to launch your editor (see
|
to launch your editor (see
|
||||||
.Xr meli.conf 5 COMPOSING Ns
|
.Xr meli.conf 5 COMPOSING Ns
|
||||||
, setting
|
, setting
|
||||||
.Ic editor_cmd
|
.Ic editor_command
|
||||||
for how to select which editor to launch).
|
for how to select which editor to launch).
|
||||||
Attachments may be handled with the
|
Attachments may be handled with the
|
||||||
.Em add-attachment Ns
|
.Em add-attachment Ns
|
||||||
|
@ -225,7 +225,7 @@ Finally, pressing
|
||||||
will send your message by piping it into a binary of your choosing (see
|
will send your message by piping it into a binary of your choosing (see
|
||||||
.Xr meli.conf 5 COMPOSING Ns
|
.Xr meli.conf 5 COMPOSING Ns
|
||||||
, setting
|
, setting
|
||||||
.Ic mailer_cmd Ns
|
.Ic mailer_command Ns
|
||||||
).
|
).
|
||||||
To save your draft without sending it, issue command
|
To save your draft without sending it, issue command
|
||||||
.Cm close
|
.Cm close
|
||||||
|
|
|
@ -106,8 +106,8 @@ script = "notify-send"
|
||||||
|
|
||||||
[composing]
|
[composing]
|
||||||
# required for sending e-mail
|
# required for sending e-mail
|
||||||
mailer_cmd = 'msmtp --read-recipients --read-envelope-from'
|
mailer_command = 'msmtp --read-recipients --read-envelope-from'
|
||||||
editor_cmd = 'vim +/^$'
|
editor_command = 'vim +/^$'
|
||||||
|
|
||||||
[shortcuts]
|
[shortcuts]
|
||||||
[shortcuts.composing]
|
[shortcuts.composing]
|
||||||
|
@ -323,9 +323,9 @@ Example:
|
||||||
.El
|
.El
|
||||||
.Sh COMPOSING
|
.Sh COMPOSING
|
||||||
.Bl -tag -width 36n
|
.Bl -tag -width 36n
|
||||||
.It Ic mailer_cmd Ar String
|
.It Ic mailer_command Ar String
|
||||||
command to pipe new mail to, exit code must be 0 for success.
|
command to pipe new mail to, exit code must be 0 for success.
|
||||||
.It Ic editor_cmd Ar String
|
.It Ic editor_command Ar String
|
||||||
command to launch editor.
|
command to launch editor.
|
||||||
Can have arguments.
|
Can have arguments.
|
||||||
Draft filename is given as the last argument.
|
Draft filename is given as the last argument.
|
||||||
|
|
|
@ -105,8 +105,8 @@
|
||||||
|
|
||||||
#[composing]
|
#[composing]
|
||||||
# required for sending e-mail
|
# required for sending e-mail
|
||||||
#mailer_cmd = 'msmtp --read-recipients --read-envelope-from'
|
#mailer_command = 'msmtp --read-recipients --read-envelope-from'
|
||||||
#editor_cmd = 'vim +/^$' # optional, by default $EDITOR is used.
|
#editor_command = 'vim +/^$' # optional, by default $EDITOR is used.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
#[pgp]
|
#[pgp]
|
||||||
|
|
|
@ -947,17 +947,17 @@ impl Component for Composer {
|
||||||
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_mail"]) =>
|
&& shortcut!(key == shortcuts[Self::DESCRIPTION]["edit_mail"]) =>
|
||||||
{
|
{
|
||||||
/* Edit draft in $EDITOR */
|
/* Edit draft in $EDITOR */
|
||||||
let editor = if let Some(editor_cmd) =
|
let editor = if let Some(editor_command) =
|
||||||
mailbox_acc_settings!(context[self.account_cursor].composing.editor_cmd)
|
mailbox_acc_settings!(context[self.account_cursor].composing.editor_command)
|
||||||
.as_ref()
|
.as_ref()
|
||||||
{
|
{
|
||||||
editor_cmd.to_string()
|
editor_command.to_string()
|
||||||
} else {
|
} else {
|
||||||
match std::env::var("EDITOR") {
|
match std::env::var("EDITOR") {
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
context.replies.push_back(UIEvent::Notification(
|
context.replies.push_back(UIEvent::Notification(
|
||||||
Some(e.to_string()),
|
Some(e.to_string()),
|
||||||
"$EDITOR is not set. You can change an envvar's value with setenv or set composing.editor_cmd setting in your configuration.".to_string(),
|
"$EDITOR is not set. You can change an envvar's value with setenv or set composing.editor_command setting in your configuration.".to_string(),
|
||||||
Some(NotificationType::ERROR),
|
Some(NotificationType::ERROR),
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
@ -1000,13 +1000,16 @@ impl Component for Composer {
|
||||||
context.input_kill();
|
context.input_kill();
|
||||||
}
|
}
|
||||||
|
|
||||||
let editor_cmd = format!("{} {}", editor, f.path().display());
|
let editor_command = format!("{} {}", editor, f.path().display());
|
||||||
log(
|
log(
|
||||||
format!("Executing: sh -c \"{}\"", editor_cmd.replace("\"", "\\\"")),
|
format!(
|
||||||
|
"Executing: sh -c \"{}\"",
|
||||||
|
editor_command.replace("\"", "\\\"")
|
||||||
|
),
|
||||||
DEBUG,
|
DEBUG,
|
||||||
);
|
);
|
||||||
match Command::new("sh")
|
match Command::new("sh")
|
||||||
.args(&["-c", &editor_cmd])
|
.args(&["-c", &editor_command])
|
||||||
.stdin(Stdio::inherit())
|
.stdin(Stdio::inherit())
|
||||||
.stdout(Stdio::inherit())
|
.stdout(Stdio::inherit())
|
||||||
.spawn()
|
.spawn()
|
||||||
|
@ -1051,18 +1054,18 @@ impl Component for Composer {
|
||||||
}
|
}
|
||||||
UIEvent::Action(ref a) => {
|
UIEvent::Action(ref a) => {
|
||||||
match a {
|
match a {
|
||||||
Action::Compose(ComposeAction::AddAttachmentPipe(ref cmd)) => {
|
Action::Compose(ComposeAction::AddAttachmentPipe(ref command)) => {
|
||||||
if cmd.is_empty() {
|
if command.is_empty() {
|
||||||
context.replies.push_back(UIEvent::Notification(
|
context.replies.push_back(UIEvent::Notification(
|
||||||
None,
|
None,
|
||||||
format!("pipe cmd value is invalid: {}", cmd),
|
format!("pipe command value is invalid: {}", command),
|
||||||
Some(NotificationType::ERROR),
|
Some(NotificationType::ERROR),
|
||||||
));
|
));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let f = create_temp_file(&[], None, None, true);
|
let f = create_temp_file(&[], None, None, true);
|
||||||
match std::process::Command::new("sh")
|
match std::process::Command::new("sh")
|
||||||
.args(&["-c", cmd])
|
.args(&["-c", command])
|
||||||
.stdin(std::process::Stdio::null())
|
.stdin(std::process::Stdio::null())
|
||||||
.stdout(std::process::Stdio::from(f.file()))
|
.stdout(std::process::Stdio::from(f.file()))
|
||||||
.spawn()
|
.spawn()
|
||||||
|
@ -1070,7 +1073,7 @@ impl Component for Composer {
|
||||||
Ok(child) => {
|
Ok(child) => {
|
||||||
let _ = child
|
let _ = child
|
||||||
.wait_with_output()
|
.wait_with_output()
|
||||||
.expect("failed to launch cmd")
|
.expect("failed to launch command")
|
||||||
.stdout;
|
.stdout;
|
||||||
let mut attachment =
|
let mut attachment =
|
||||||
match melib::email::attachment_from_file(f.path()) {
|
match melib::email::attachment_from_file(f.path()) {
|
||||||
|
@ -1100,7 +1103,7 @@ impl Component for Composer {
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
context.replies.push_back(UIEvent::Notification(
|
context.replies.push_back(UIEvent::Notification(
|
||||||
None,
|
None,
|
||||||
format!("could not execute pipe cmd {}: {}", cmd, err),
|
format!("could not execute pipe command {}: {}", command, err),
|
||||||
Some(NotificationType::ERROR),
|
Some(NotificationType::ERROR),
|
||||||
));
|
));
|
||||||
return true;
|
return true;
|
||||||
|
@ -1280,18 +1283,18 @@ pub fn send_draft(
|
||||||
use std::io::Write;
|
use std::io::Write;
|
||||||
use std::process::{Command, Stdio};
|
use std::process::{Command, Stdio};
|
||||||
let format_flowed = *mailbox_acc_settings!(context[account_cursor].composing.format_flowed);
|
let format_flowed = *mailbox_acc_settings!(context[account_cursor].composing.format_flowed);
|
||||||
let cmd = mailbox_acc_settings!(context[account_cursor].composing.mailer_cmd);
|
let command = mailbox_acc_settings!(context[account_cursor].composing.mailer_command);
|
||||||
if cmd.is_empty() {
|
if command.is_empty() {
|
||||||
context.replies.push_back(UIEvent::Notification(
|
context.replies.push_back(UIEvent::Notification(
|
||||||
None,
|
None,
|
||||||
String::from("mailer_cmd configuration value is empty"),
|
String::from("mailer_command configuration value is empty"),
|
||||||
Some(NotificationType::ERROR),
|
Some(NotificationType::ERROR),
|
||||||
));
|
));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
let bytes;
|
let bytes;
|
||||||
let mut msmtp = Command::new("sh")
|
let mut msmtp = Command::new("sh")
|
||||||
.args(&["-c", cmd])
|
.args(&["-c", command])
|
||||||
.stdin(Stdio::piped())
|
.stdin(Stdio::piped())
|
||||||
.stdout(Stdio::piped())
|
.stdout(Stdio::piped())
|
||||||
.spawn()
|
.spawn()
|
||||||
|
@ -1395,12 +1398,12 @@ pub fn send_draft(
|
||||||
let error_message = if let Some(exit_code) = output.code() {
|
let error_message = if let Some(exit_code) = output.code() {
|
||||||
format!(
|
format!(
|
||||||
"Could not send e-mail using `{}`: Process exited with {}",
|
"Could not send e-mail using `{}`: Process exited with {}",
|
||||||
cmd, exit_code
|
command, exit_code
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
format!(
|
format!(
|
||||||
"Could not send e-mail using `{}`: Process was killed by signal",
|
"Could not send e-mail using `{}`: Process was killed by signal",
|
||||||
cmd
|
command
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
context.replies.push_back(UIEvent::Notification(
|
context.replies.push_back(UIEvent::Notification(
|
||||||
|
|
|
@ -28,11 +28,16 @@ use std::collections::HashMap;
|
||||||
pub struct ComposingSettings {
|
pub struct ComposingSettings {
|
||||||
/// A command to pipe new emails to
|
/// A command to pipe new emails to
|
||||||
/// Required
|
/// Required
|
||||||
#[serde(alias = "mailer-cmd")]
|
#[serde(alias = "mailer-command", alias = "mailer-cmd", alias = "mailer_cmd")]
|
||||||
pub mailer_cmd: String,
|
pub mailer_command: String,
|
||||||
/// Command to launch editor. Can have arguments. Draft filename is given as the last argument. If it's missing, the environment variable $EDITOR is looked up.
|
/// Command to launch editor. Can have arguments. Draft filename is given as the last argument. If it's missing, the environment variable $EDITOR is looked up.
|
||||||
#[serde(default = "none", alias = "editor-cmd")]
|
#[serde(
|
||||||
pub editor_cmd: Option<String>,
|
default = "none",
|
||||||
|
alias = "editor-command",
|
||||||
|
alias = "editor-cmd",
|
||||||
|
alias = "editor_cmd"
|
||||||
|
)]
|
||||||
|
pub editor_command: Option<String>,
|
||||||
/// Embed editor (for terminal interfaces) instead of forking and waiting.
|
/// Embed editor (for terminal interfaces) instead of forking and waiting.
|
||||||
#[serde(default = "false_val")]
|
#[serde(default = "false_val")]
|
||||||
pub embed: bool,
|
pub embed: bool,
|
||||||
|
@ -49,8 +54,8 @@ pub struct ComposingSettings {
|
||||||
impl Default for ComposingSettings {
|
impl Default for ComposingSettings {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ComposingSettings {
|
ComposingSettings {
|
||||||
mailer_cmd: String::new(),
|
mailer_command: String::new(),
|
||||||
editor_cmd: None,
|
editor_command: None,
|
||||||
embed: false,
|
embed: false,
|
||||||
format_flowed: true,
|
format_flowed: true,
|
||||||
default_header_values: HashMap::default(),
|
default_header_values: HashMap::default(),
|
||||||
|
|
|
@ -202,12 +202,13 @@ impl Default for ShortcutsOverride {
|
||||||
pub struct ComposingSettingsOverride {
|
pub struct ComposingSettingsOverride {
|
||||||
#[doc = " A command to pipe new emails to"]
|
#[doc = " A command to pipe new emails to"]
|
||||||
#[doc = " Required"]
|
#[doc = " Required"]
|
||||||
|
#[serde(alias = "mailer-command", alias = "mailer-cmd", alias = "mailer_cmd")]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub mailer_cmd: Option<String>,
|
pub mailer_command: Option<String>,
|
||||||
#[doc = " Command to launch editor. Can have arguments. Draft filename is given as the last argument. If it's missing, the environment variable $EDITOR is looked up."]
|
#[doc = " Command to launch editor. Can have arguments. Draft filename is given as the last argument. If it's missing, the environment variable $EDITOR is looked up."]
|
||||||
#[serde(alias = "editor-cmd")]
|
#[serde(alias = "editor-command", alias = "editor-cmd", alias = "editor_cmd")]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub editor_cmd: Option<Option<String>>,
|
pub editor_command: Option<Option<String>>,
|
||||||
#[doc = " Embed editor (for terminal interfaces) instead of forking and waiting."]
|
#[doc = " Embed editor (for terminal interfaces) instead of forking and waiting."]
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub embed: Option<bool>,
|
pub embed: Option<bool>,
|
||||||
|
@ -225,8 +226,8 @@ pub struct ComposingSettingsOverride {
|
||||||
impl Default for ComposingSettingsOverride {
|
impl Default for ComposingSettingsOverride {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
ComposingSettingsOverride {
|
ComposingSettingsOverride {
|
||||||
mailer_cmd: None,
|
mailer_command: None,
|
||||||
editor_cmd: None,
|
editor_command: None,
|
||||||
embed: None,
|
embed: None,
|
||||||
format_flowed: None,
|
format_flowed: None,
|
||||||
default_header_values: None,
|
default_header_values: None,
|
||||||
|
|
Loading…
Reference in New Issue