diff options
Diffstat (limited to 'scripts/xdg-email')
-rwxr-xr-x | scripts/xdg-email | 185 |
1 files changed, 94 insertions, 91 deletions
diff --git a/scripts/xdg-email b/scripts/xdg-email index b1f2f5e..96a8784 100755 --- a/scripts/xdg-email +++ b/scripts/xdg-email @@ -37,135 +37,122 @@ manualpage() cat << _MANUALPAGE Name - xdg-email -- command line tool for sending mail using the user's preferred - e-mail composer +xdg-email — command line tool for sending mail using the user's preferred +e-mail composer Synopsis - xdg-email [--utf8] [--cc address] [--bcc address] [--subject text] [--body - text] [--attach file] { mailto-uri | address(es) } +xdg-email [--utf8] [--cc address] [--bcc address] [--subject text] [--body text +] [--attach file] { mailto-uri | address(es) } - xdg-email { --help | --manual | --version } +xdg-email { --help | --manual | --version } Description - xdg-email opens the user's preferred e-mail composer in order to send a - mail to address(es) or mailto-uri. RFC2368 defines mailto: URIs. xdg-email - limits support to, cc, subject and body fields in mailto-uri, all other - fields are silently ignored. address(es) must follow the syntax of RFC822. - Multiple addresses may be provided as separate arguments. +xdg-email opens the user's preferred e-mail composer in order to send a mail to +address(es) or mailto-uri. RFC2368 defines mailto: URIs. xdg-email limits +support to, cc, subject and body fields in mailto-uri, all other fields are +silently ignored. address(es) must follow the syntax of RFC822. Multiple +addresses may be provided as separate arguments. - All information provided on the command line is used to prefill - corresponding fields in the user's e-mail composer. The user will have the - opportunity to change any of this information before actually sending the - e-mail. +All information provided on the command line is used to prefill corresponding +fields in the user's e-mail composer. The user will have the opportunity to +change any of this information before actually sending the e-mail. - xdg-email is for use inside a desktop session only. It is not recommended - to use xdg-email as root. +xdg-email is for use inside a desktop session only. It is not recommended to +use xdg-email as root. - See http://portland.freedesktop.org/EmailConfig for information on how the - user can change the e-mail composer that is used. +See http://portland.freedesktop.org/EmailConfig for information on how the user +can change the e-mail composer that is used. Options - --utf8 - Indicates that all command line options that follow are in utf8. - Without this option, command line options are expected to be - encoded according to locale. If the locale already specifies utf8 - this option has no effect. This option does not affect mailto URIs - that are passed on the command line. - - --cc address - Specify a recipient to be copied on the e-mail. - - --bcc address - Specify a recipient to be blindly copied on the e-mail. - - --subject text - Specify a subject for the e-mail. - - --body text - Specify a body for the e-mail. Since the user will be able to make - changes before actually sending the e-mail, this can be used to - provide the user with a template for the e-mail. text may contain - linebreaks. - - --attach file - - Specify an attachment for the e-mail. file must point to an - existing file. - - Some e-mail applications require the file to remain present after - xdg-email returns. - - --help - Show command synopsis. - - --manual - Show this manualpage. - - --version - Show the xdg-utils version information. +--utf8 + Indicates that all command line options that follow are in utf8. Without + this option, command line options are expected to be encoded according to + locale. If the locale already specifies utf8 this option has no effect. + This option does not affect mailto URIs that are passed on the command + line. +--cc address + Specify a recipient to be copied on the e-mail. +--bcc address + Specify a recipient to be blindly copied on the e-mail. +--subject text + Specify a subject for the e-mail. +--body text + Specify a body for the e-mail. Since the user will be able to make changes + before actually sending the e-mail, this can be used to provide the user + with a template for the e-mail. text may contain linebreaks. +--attach file + + Specify an attachment for the e-mail. file must point to an existing file. + + Some e-mail applications require the file to remain present after xdg-email + returns. + +--help + Show command synopsis. +--manual + Show this manualpage. +--version + Show the xdg-utils version information. Environment Variables - xdg-email honours the following environment variables: +xdg-email honours the following environment variables: - XDG_UTILS_DEBUG_LEVEL - Setting this environment variable to a non-zero numerical value - makes xdg-email do more verbose reporting on stderr. Setting a - higher value increases the verbosity. +XDG_UTILS_DEBUG_LEVEL + Setting this environment variable to a non-zero numerical value makes + xdg-email do more verbose reporting on stderr. Setting a higher value + increases the verbosity. Exit Codes - An exit code of 0 indicates success while a non-zero exit code indicates - failure. The following failure codes can be returned: - - 1 - Error in command line syntax. +An exit code of 0 indicates success while a non-zero exit code indicates +failure. The following failure codes can be returned: - 2 - One of the files passed on the command line did not exist. - - 3 - A required tool could not be found. - - 4 - The action failed. - - 5 - No permission to read one of the files passed on the command line. +1 + Error in command line syntax. +2 + One of the files passed on the command line did not exist. +3 + A required tool could not be found. +4 + The action failed. +5 + No permission to read one of the files passed on the command line. See Also - http://portland.freedesktop.org/EmailConfig +http://portland.freedesktop.org/EmailConfig Examples - xdg-email 'Jeremy White <jwhite@example.com>' +xdg-email 'Jeremy White <jwhite@example.com>' - xdg-email --attach /tmp/logo.png \ - --subject 'Logo contest' \ - --body 'Attached you find the logo for the contest.' \ - 'jwhite@example.com' +xdg-email --attach /tmp/logo.png \ + --subject 'Logo contest' \ + --body 'Attached you find the logo for the contest.' \ + 'jwhite@example.com' + +xdg-email --subject 'Your password is about to expire' \ + 'jwhite@example.com' 'bastian@example.com' 'whipple@example.com' - xdg-email --subject 'Your password is about to expire' \ - 'jwhite@example.com' 'bastian@example.com' 'whipple@example.com' _MANUALPAGE } usage() { cat << _USAGE - xdg-email -- command line tool for sending mail using the user's preferred - e-mail composer +xdg-email — command line tool for sending mail using the user's preferred +e-mail composer Synopsis - xdg-email [--utf8] [--cc address] [--bcc address] [--subject text] [--body - text] [--attach file] { mailto-uri | address(es) } +xdg-email [--utf8] [--cc address] [--bcc address] [--subject text] [--body text +] [--attach file] { mailto-uri | address(es) } - xdg-email { --help | --manual | --version } +xdg-email { --help | --manual | --version } _USAGE } @@ -285,6 +272,22 @@ check_input_file() fi } +check_vendor_prefix() +{ + file=`basename "$1"` + case "$file" in + [a-zA-Z]*-*) + return + ;; + esac + + echo "xdg-email: filename '$file' does not have a proper vendor prefix" >&2 + echo 'A vendor prefix consists of alpha characters ([a-zA-Z]) and is terminated' >&2 + echo 'with a dash ("-"). An example filename is '"'example-$file'" >&2 + echo "Use --novendor to override or 'xdg-email --manual' for additional info." >&2 + exit 1 +} + check_output_file() { # if the file exists, check if it is writeable @@ -323,7 +326,7 @@ check_common_commands() ;; --version) - echo "xdg-email 1.0beta1" + echo "xdg-email 1.0beta2" exit_success ;; esac |