Unified · Split
| @@ -53,6 +53,7 @@ impl<'a> Edits<'a> { · 52 unmodified lines | ||
| 53 | 53 | self |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | + /// Assure new values are matching [these rules](https://github.com/git/git/blob/66e871b6647ffea61a77a0f82c7ef3415f1ee79c/Documentation/config.txt#L17:L20) | |
| 56 | 57 | pub fn to_write(&self, _out: impl io::Write) -> io::Result<()> { |
| 57 | 58 | unimplemented!("to write") |
| 58 | 59 | } |
| @@ -1,6 +1,13 @@ | ||
| 1 | 1 | #![forbid(unsafe_code)] |
| 2 | 2 | // #![forbid(rust_2018_idioms)] |
| 3 | 3 | #![allow(dead_code)] |
| 4 | +//! This crate aims to parse all `git` configuration files found in the wild and apply the same restrictions by default. | |
| 5 | +//! It will do so while providing helpful error messages in case of syntax errors. | |
| 6 | +//! | |
| 7 | +//! Editing is fully supported and non-destructive. | |
| 8 | +//! | |
| 9 | +//! Additionally it's a stated goal as well to apply such restrictions only when values are read and optionally allow | |
| 10 | +//! a less limited character set. This opens up the git configuration format to other languages than English. | |
| 4 | 11 | |
| 5 | 12 | use std::ops::Range; |
| 6 | 13 | |
| @@ -1,15 +1,19 @@ | ||
| 1 | 1 | use crate::Span; |
| 2 | 2 | |
| 3 | 3 | // we parse leading and trailing whitespace into comments, avoiding the notion of whitespace. |
| 4 | −// This means we auto-trim whitespace otherwise, which I consider a feature | |
| 5 | −pub(crate) type Comment = Span; | |
| 4 | +// This means we auto-trim whitespace otherwise, which we a feature. | |
| 5 | +// All whitespace is automatically an empty comment. | |
| 6 | +#[derive(Clone, PartialOrd, PartialEq, Ord, Eq)] | |
| 7 | +pub(crate) struct Comment(Span); | |
| 6 | 8 | |
| 7 | 9 | /// A section or sub-section (in case `sub_name` is `Some()`), i.e. |
| 8 | 10 | /// |
| 9 | 11 | /// ```text |
| 10 | −/// [hello] | |
| 12 | +/// [section] | |
| 13 | +/// | |
| 14 | +/// [section.sub-section] | |
| 11 | 15 | /// |
| 12 | −/// [hello.world] | |
| 16 | +/// [section "Sub-Section"] | |
| 13 | 17 | /// ``` |
| 14 | 18 | #[derive(Clone, PartialOrd, PartialEq, Ord, Eq)] |
| 15 | 19 | pub(crate) struct Section { |
| @@ -8,6 +8,19 @@ · 7 unmodified lines | ||
| 8 | 8 | * [x] use `git-id` inside of `git-features`, remove cycle |
| 9 | 9 | * **git-config** |
| 10 | 10 | * A complete implementation, writing a the git remote configuration is needed for finalizing the clone |
| 11 | + * **API round trip** - read - edit - write - read | |
| 12 | + * [ ] parse sections (not sub-sections) and whitespace/comments | |
| 13 | + * [ ] write all | |
| 14 | + * [ ] Add section | |
| 15 | + * [ ] write all | |
| 16 | + * [ ] rename section | |
| 17 | + * [ ] write all | |
| 18 | + * [ ] delete section | |
| 19 | + * [ ] write all | |
| 20 | + * [ ] Sections lookup | |
| 21 | + * [ ] case-insensitive section | |
| 22 | + * [ ] case-sensitive subsection | |
| 23 | + * [ ] case sensitive 'legacy section.subsection' lookup | |
| 11 | 24 | * [ ] `Config` type which integrates multiple files into one interface, much like a *multi* version of `File` |
| 12 | 25 | * **git-ref** |
| 13 | 26 | * [ ] create ref pointing to ID |