Skip to content

Instantly share code, notes, and snippets.

@anna-is-cute
Created July 12, 2016 06:32
Show Gist options
  • Save anna-is-cute/a01aab0f9460df4fb83fc1726598bcc2 to your computer and use it in GitHub Desktop.
Save anna-is-cute/a01aab0f9460df4fb83fc1726598bcc2 to your computer and use it in GitHub Desktop.
struct Rules<'a> {
order: Option<Order<'a>>,
must_exist: Option<bool>,
must_be_unique: Option<bool>
}
struct Order<'a> {
paths: Option<Vec<Path<'a>>>,
sort: Option<Sort>
}
struct Path<'a> {
exact: Option<&'a str>,
contains: Option<&'a str>,
default: Option<bool>
}
struct Sort {
alphabetical: Option<SortOption>,
path_component_length: Option<SortOption>
}
enum SortOption {
Enabled,
Disabled,
Reversed
}
{
"rules": {
"order": {
"paths": [
{"exact": "/usr/local/bin"},
{"exact": "/usr/local/sbin"},
{"contains": ".rvm"},
{"default": true}
{"exact": "/bin"},
{"exact": "/sbin"}
],
"sort": {
"alphabetical": "yes",
"path_component_length": "reverse"
}
},
"must_exist": true,
"must_be_unique": true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment