Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/common/drive_file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ pub const EXTENSION_PPTX: &str = "pptx";
pub const EXTENSION_ODP: &str = "odp";
pub const EXTENSION_EPUB: &str = "epub";
pub const EXTENSION_TXT: &str = "txt";
pub const EXTENSION_MD: &str = "md";

pub const MIME_TYPE_DOC: &str = "application/msword";
pub const MIME_TYPE_DOCX: &str =
Expand All @@ -44,6 +45,7 @@ pub const MIME_TYPE_XLS: &str = "application/vnd.ms-excel";
pub const MIME_TYPE_XLSX: &str =
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
pub const MIME_TYPE_CSV: &str = "text/csv";
pub const MIME_TYPE_MD: &str = "text/markdown";
pub const MIME_TYPE_TSV: &str = "text/tab-separated-values";
pub const MIME_TYPE_ODS: &str = "application/vnd.oasis.opendocument.spreadsheet";
pub const MIME_TYPE_PPT: &str = "application/vnd.ms-powerpoint";
Expand Down Expand Up @@ -72,6 +74,7 @@ impl DocType {
(FileExtension::Rtf, DocType::Document),
(FileExtension::Pdf, DocType::Document),
(FileExtension::Html, DocType::Document),
(FileExtension::Md, DocType::Document),
(FileExtension::Xls, DocType::Spreadsheet),
(FileExtension::Xlsx, DocType::Spreadsheet),
(FileExtension::Csv, DocType::Spreadsheet),
Expand Down Expand Up @@ -133,6 +136,7 @@ impl DocType {
FileExtension::Epub,
FileExtension::Rtf,
FileExtension::Txt,
FileExtension::Md,
FileExtension::Html,
],

Expand Down Expand Up @@ -194,6 +198,7 @@ pub enum FileExtension {
Odp,
Epub,
Txt,
Md,
}

impl fmt::Display for FileExtension {
Expand All @@ -219,6 +224,7 @@ impl fmt::Display for FileExtension {
FileExtension::Odp => write!(f, "{}", EXTENSION_ODP),
FileExtension::Epub => write!(f, "{}", EXTENSION_EPUB),
FileExtension::Txt => write!(f, "{}", EXTENSION_TXT),
FileExtension::Md => write!(f, "{}", EXTENSION_MD),
}
}
}
Expand Down Expand Up @@ -248,6 +254,7 @@ impl FileExtension {
EXTENSION_ODP => Some(FileExtension::Odp),
EXTENSION_EPUB => Some(FileExtension::Epub),
EXTENSION_TXT => Some(FileExtension::Txt),
EXTENSION_MD => Some(FileExtension::Md),
_ => None,
}
}
Expand All @@ -274,6 +281,7 @@ impl FileExtension {
FileExtension::Odp => MIME_TYPE_ODP.parse().ok(),
FileExtension::Epub => MIME_TYPE_EPUB.parse().ok(),
FileExtension::Txt => MIME_TYPE_TXT.parse().ok(),
FileExtension::Md => MIME_TYPE_MD.parse().ok(),
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ enum FileCommand {
},

/// Import file as a google document/spreadsheet/presentation.
/// Example of file types that can be imported: doc, docx, odt, pdf, html, xls, xlsx, csv, ods, ppt, pptx, odp
/// Example of file types that can be imported: doc, docx, odt, pdf, html, xls, xlsx, csv, ods, ppt, pptx, odp, md
Import {
/// Path to file
file_path: PathBuf,
Expand Down