mirror of
https://firefish.dev/firefish/emoji-gen.git
synced 2024-09-19 11:50:21 -06:00
Adding timestamp, editorconfig, update README, LICENSE (BSD as previously)
This commit is contained in:
parent
32e99bae10
commit
583d3645ca
7 changed files with 121 additions and 84 deletions
21
.editorconfig
Normal file
21
.editorconfig
Normal file
|
@ -0,0 +1,21 @@
|
|||
# EditorConfig helps developers define and maintain consistent
|
||||
# coding styles between different editors and IDEs
|
||||
# editorconfig.org
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
indent_style = tab
|
||||
indent_size = 4
|
||||
|
||||
[*.rs]
|
||||
max_line_length = 100
|
||||
|
||||
[*.md]
|
||||
# double whitespace at end of line
|
||||
# denotes a line break in Markdown
|
||||
trim_trailing_whitespace = false
|
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -13,9 +13,3 @@ Cargo.lock
|
|||
|
||||
# MSVC Windows builds of rustc generate these, which store debugging information
|
||||
*.pdb
|
||||
|
||||
|
||||
|
||||
# Added by cargo
|
||||
|
||||
/target
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
[package]
|
||||
name = "emoji-gen"
|
||||
description = "Emoji import file generator for Firefish"
|
||||
license = "MIT"
|
||||
license = "BSD"
|
||||
readme = "README.md"
|
||||
homepage = "https://git.joinfirefish.org/firefish/emoji-gen"
|
||||
repository = "https://git.joinfirefish.org/firefish/emoji-gen"
|
||||
authors = ["cutestnekoaqua <waterdev@galaxcrow.de>", "Mehdi Benadel <mehdi.benadel@gmail.com>"]
|
||||
version = "0.3.3"
|
||||
version = "0.3.4"
|
||||
edition = "2021"
|
||||
|
||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||
|
@ -29,6 +29,8 @@ env_logger = "0.10.0"
|
|||
log = "0.4.19"
|
||||
indicatif = {version = "0.17.5", features = ["rayon"]}
|
||||
rayon = "1.7.0"
|
||||
datetime = "0.5.2"
|
||||
chrono = "0.4.26"
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = "0.10.0"
|
||||
|
|
17
LICENSE
17
LICENSE
|
@ -1,17 +0,0 @@
|
|||
Permission is hereby granted, without written agreement and without
|
||||
license or royalty fees, to use, copy, modify, and distribute this
|
||||
software and its documentation for any purpose, provided that the
|
||||
above copyright notice and the following two paragraphs appear in
|
||||
all copies of this software.
|
||||
|
||||
IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
|
||||
DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
|
||||
ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
|
||||
IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGE.
|
||||
|
||||
THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
|
||||
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
|
||||
ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
|
||||
PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
|
28
LICENSE.md
Normal file
28
LICENSE.md
Normal file
|
@ -0,0 +1,28 @@
|
|||
# BSD 3-Clause License
|
||||
|
||||
_Copyright (c) 2023 April John, Mehdi Benadel_
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
11
README.md
11
README.md
|
@ -7,7 +7,14 @@ A script written in Rust to generate a ZIP with right formating for a emoji pack
|
|||
Put all emojis you want to import in a folder, use subfolders for different groups.
|
||||
|
||||
```a
|
||||
cargo install emoji-gen
|
||||
emoji-gen --folder . [optionally add --group "GroupName"]
|
||||
git clone https://git.joinfirefish.org/firefish/emoji-gen.git
|
||||
|
||||
cargo install --path .
|
||||
|
||||
# To create an import zip from an emoji folder
|
||||
emoji-gen local --folder <emoji_folder> [--output <output_zip_file>]
|
||||
|
||||
# To create an import zip from a remote instance
|
||||
emoji-gen crawl --host https://firefish.social [--output <output_zip_file>]
|
||||
```
|
||||
upload the zip file to Firefish and import it.
|
34
src/main.rs
34
src/main.rs
|
@ -26,6 +26,8 @@ use zip::write::FileOptions;
|
|||
use env_logger;
|
||||
use log::{debug, warn, error};
|
||||
|
||||
use chrono::Local;
|
||||
|
||||
#[derive(Parser, Debug)]
|
||||
#[command(author, version, about, long_about = None)]
|
||||
struct Cli {
|
||||
|
@ -36,7 +38,7 @@ struct Cli {
|
|||
|
||||
#[derive(Debug, Subcommand)]
|
||||
enum Command {
|
||||
/// Help message for read.
|
||||
/// Create a zip from a local folder
|
||||
Local {
|
||||
/// Output file path
|
||||
#[arg(short = 'o', long = "output", default_value_t = String::from("generated_emojis"))]
|
||||
|
@ -54,14 +56,14 @@ enum Command {
|
|||
#[arg(short, long, default_value_t = ("Custom").to_string())]
|
||||
group: String,
|
||||
},
|
||||
/// Help message for write.
|
||||
/// Create a zip from a remote instance content
|
||||
Crawl {
|
||||
/// Output file path
|
||||
#[arg(short = 'o', long = "output", default_value_t = String::from("generated_emojis"))]
|
||||
outputFilepath: String,
|
||||
|
||||
/// Host to crawl emojis from
|
||||
#[arg(short = 'h', long = "host", default_value_t = String::from("https://firefish.social"))]
|
||||
#[arg(short, long)]
|
||||
host: String,
|
||||
},
|
||||
}
|
||||
|
@ -100,24 +102,24 @@ struct EmojiData {
|
|||
|
||||
fn getTypename(typeEnum: imghdr::Type) -> &'static str {
|
||||
return match typeEnum {
|
||||
imghdr::Type::Gif => "gif",
|
||||
imghdr::Type::Tiff => "tiff",
|
||||
imghdr::Type::Rast => "rast",
|
||||
imghdr::Type::Xbm => "xbm",
|
||||
imghdr::Type::Jpeg => "jpg",
|
||||
imghdr::Type::Bmp => "bmp",
|
||||
imghdr::Type::Png => "png",
|
||||
imghdr::Type::Webp => "webp",
|
||||
imghdr::Type::Exr => "exr",
|
||||
imghdr::Type::Avif => "avif",
|
||||
imghdr::Type::Bgp => "bgp",
|
||||
imghdr::Type::Bmp => "bmp",
|
||||
imghdr::Type::Exr => "exr",
|
||||
imghdr::Type::Flif => "flif",
|
||||
imghdr::Type::Gif => "gif",
|
||||
imghdr::Type::Ico => "ico",
|
||||
imghdr::Type::Jpeg => "jpg",
|
||||
imghdr::Type::Pbm => "pbm",
|
||||
imghdr::Type::Pgm => "pgm",
|
||||
imghdr::Type::Png => "png",
|
||||
imghdr::Type::Ppm => "ppm",
|
||||
imghdr::Type::Rast => "rast",
|
||||
imghdr::Type::Rgb => "rgb",
|
||||
imghdr::Type::Rgbe => "rgbe",
|
||||
imghdr::Type::Flif => "flif",
|
||||
imghdr::Type::Ico => "ico",
|
||||
imghdr::Type::Avif => "avif",
|
||||
imghdr::Type::Tiff => "tiff",
|
||||
imghdr::Type::Webp => "webp",
|
||||
imghdr::Type::Xbm => "xbm",
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -413,7 +415,7 @@ fn generate_meta(
|
|||
let meta = Meta {
|
||||
metaVersion: 1,
|
||||
host: host,
|
||||
exportedAt: "".to_string(),
|
||||
exportedAt: Local::now().to_rfc3339(),
|
||||
emojis: emojis,
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue