~phate/ppkg

64f10d2295fc226b59a5839cc1e946298b7589bc — ValleyKnight 3 years ago e67ac6e
add filezilla package
3 files changed, 35 insertions(+), 0 deletions(-)

M config.toml
M src/commands.rs
M src/main.rs
M config.toml => config.toml +7 -0
@@ 4,6 4,13 @@ package_description = "A proprietary instant messaging platform. It is HIGHLY re
package_version = "0.0.13"
package_url = "https://dl.discordapp.net/apps/linux/0.0.13/discord-0.0.13.tar.gz"

[filezilla]
package_name = "FileZilla"
package_description = "A FOSS FTP/SFTP/FTPS client."
package_version = "3.51.0"
package_url_32 = "https://dl4.cdn.filezilla-project.org/client/FileZilla_3.51.0_i686-linux-gnu.tar.bz2?h=l99fdW4NWUoX-YbpS-jiKg&x=1609166094"
package_url_64 = "https://dl4.cdn.filezilla-project.org/client/FileZilla_3.51.0_x86_64-linux-gnu.tar.bz2?h=kdlGbGvcG_AQ6K645kfAJQ&x=1609166094"

[firefox]
package_name = "Firefox"
package_description = "Not the best browser, but better than some other choices for sure."

M src/commands.rs => src/commands.rs +27 -0
@@ 12,6 12,8 @@ pub fn install(config_path: &str, home: &str, matches: &ArgMatches) {

    let name = if pkg == serde::export::Some("Discord") {
        config.discord.package_name
    } else if pkg == serde::export::Some("FileZilla") {
        config.filezilla.package_name
    } else if pkg == serde::export::Some("Firefox") {
        config.firefox.package_name
    } else if pkg == serde::export::Some("Github CLI") {


@@ 24,6 26,19 @@ pub fn install(config_path: &str, home: &str, matches: &ArgMatches) {

    let url = if name == "Discord" {
        config.discord.package_url
    } else if name == "FileZilla" {
        println!("This package supports 32-bit and 64-bit, please choose a version. (x32 or x64)");
        let mut arch = String::new();
        std::io::stdin()
            .read_line(&mut arch)
            .expect("Failed to read user input.");
        if arch.trim() == "x32" {
            config.filezilla.package_url_32
        } else if arch.trim() == "x64" {
            config.filezilla.package_url_64
        } else {
            panic!("You need to choose x32 or x64!");
        }
    } else if name == "Firefox" {
        println!("This package supports 32-bit and 64-bit, please choose a version. (x32 or x64)");
        let mut arch = String::new();


@@ 109,6 124,14 @@ pub fn list(config_path: &str, home: &str, matches: &ArgMatches) {
        );
        println!(
            "Name: {}\nDescription: {}\nVersion: {}\nURL (x32): {}\nURL (x64): {}\n",
            config.filezilla.package_name,
            config.filezilla.package_description,
            config.filezilla.package_version,
            config.filezilla.package_url_32,
            config.filezilla.package_url_64,
        );
        println!(
            "Name: {}\nDescription: {}\nVersion: {}\nURL (x32): {}\nURL (x64): {}\n",
            config.firefox.package_name,
            config.firefox.package_description,
            config.firefox.package_version,


@@ 133,6 156,7 @@ pub fn list(config_path: &str, home: &str, matches: &ArgMatches) {
    } else if matches.is_present("installed") {
        let config: Config = toml::from_str(&std::fs::read_to_string(config_path).unwrap()).unwrap();
        let install_path_discord = format!("{}/.ppkg/opt/{}", home, config.discord.package_name);
        let install_path_filezilla = format!("{}/.ppkg/opt/{}", home, config.filezilla.package_name);
        let install_path_firefox = format!("{}/.ppkg/opt/{}", home, config.firefox.package_name);
        let install_path_ghcli = format!("{}/.ppkg/opt/{}", home, config.ghcli.package_name);
        let install_path_palemoon = format!("{}/.ppkg/opt/{}", home, config.palemoon.package_name);


@@ 140,6 164,9 @@ pub fn list(config_path: &str, home: &str, matches: &ArgMatches) {
        if fs::metadata(install_path_discord).is_ok() {
            println!("- Discord");
        }
        if fs::metadata(install_path_filezilla).is_ok() {
            println!("- FileZilla");
        }
        if fs::metadata(install_path_firefox).is_ok() {
            println!("- Firefox");
        }

M src/main.rs => src/main.rs +1 -0
@@ 6,6 6,7 @@ use serde_derive::Deserialize;
#[derive(Deserialize)]
pub struct Config {
    discord: Package,
    filezilla: PackageMultiArch,
    firefox: PackageMultiArch,
    ghcli: PackageMultiArch,
    palemoon: Package,