-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
781 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,10 @@ | ||
[target.'cfg(all(windows, target_env = "msvc"))'] | ||
[target.'cfg(target_env = "msvc")'] | ||
rustflags = ["-C", "target-feature=+crt-static"] | ||
|
||
[target.'cfg(target_env = "musl")'] | ||
rustflags = [ | ||
"-C", | ||
"target-feature=+crt-static", | ||
"-L", | ||
"-Wl,--copy-dt-needed-entries", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[workspace] | ||
resolver = "2" | ||
members = ["files"] | ||
members = ["files", "meepis"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "meepis" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[target.'cfg(windows)'.dependencies] | ||
windows = { version = "0.51.1", features = [ | ||
"Win32_Foundation", | ||
"Win32_Storage_FileSystem", | ||
] } | ||
|
||
[dependencies] | ||
anyhow = "1.0.75" | ||
camino = { version = "1.1.6", features = ["serde1"] } | ||
clap = { version = "4.4.6", features = ["derive"] } | ||
dirs = "5.0.1" | ||
faccess = "0.2.4" | ||
file-id = "0.2.1" | ||
serde = { version = "1.0.189", features = ["derive"] } | ||
serde_json = "1.0.107" | ||
shellexpand = "3.1.0" | ||
walkdir = "2.4.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: files | ||
|
||
provision: | ||
when: declaration in ["files", "directories"] | ||
|
||
schema: | ||
$schema: https://json-schema.org/draft/2020-12/schema | ||
# TODO: fix this, schemas need to be associated with their relevant declarations... | ||
anyOf: | ||
- type: string | ||
- type: object | ||
properties: | ||
source: | ||
type: string | ||
destination: | ||
type: string | ||
link_files: | ||
type: boolean | ||
required: | ||
- source | ||
- destination | ||
|
||
--- | ||
when: | ||
- os == "macos" | ||
- arch == "x86_64" | ||
executable: assets/x86_64-apple-darwin/files | ||
|
||
--- | ||
when: | ||
- os == "macos" | ||
- arch == "aarch64" | ||
executable: assets/aarch64-apple-darwin/files | ||
|
||
--- | ||
when: | ||
- os == "linux" | ||
- arch == "x86_64" | ||
executable: assets/x86_64-unknown-linux-musl/files | ||
|
||
--- | ||
when: | ||
- family == "windows" | ||
- arch == "x86_64" | ||
executable: assets/x86_64-pc-windows-msvc/files.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
use anyhow::Error; | ||
use camino::Utf8PathBuf; | ||
use clap::{arg, Args, Parser, Subcommand}; | ||
use serde::Deserialize; | ||
|
||
#[derive(Debug, Parser)] | ||
#[command(about, version)] | ||
pub struct Arguments { | ||
#[command(subcommand)] | ||
pub command: Commands, | ||
} | ||
|
||
#[derive(Debug, Subcommand)] | ||
pub enum Commands { | ||
Provision(Provision), | ||
} | ||
|
||
#[derive(Debug, Args)] | ||
pub struct Provision { | ||
/// Provision info as json | ||
#[arg(value_name = "info", value_parser = ProvisionInfo::value_parser)] | ||
pub info: ProvisionInfo, | ||
} | ||
|
||
#[derive(Debug, Deserialize, Clone)] | ||
pub struct ProvisionInfo { | ||
pub sources: Vec<Utf8PathBuf>, | ||
// pub vars: serde_json::Map<String, serde_json::Value>, | ||
} | ||
|
||
impl ProvisionInfo { | ||
fn value_parser(value: &str) -> Result<Self, Error> { | ||
Ok(serde_json::from_str(value)?) | ||
} | ||
} |
Oops, something went wrong.