1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//! Draftline provides Git-native versioning for creative content workflows.
//!
//! The public API uses content-workflow terms such as [`Workspace`],
//! [`Version`], and [`Variation`] while keeping Git as an implementation
//! detail for most callers.
//!
//! # Content policy
//!
//! Use [`ContentPolicy`] to define which workspace files are user content.
//!
//! ```no_run
//! use draftline::{ContentPolicy, Workspace};
//!
//! fn main() -> Result<(), draftline::DraftlineError> {
//! let policy = ContentPolicy::new()
//! .include_paths(["content", "assets"])?
//! .include_extensions(["md", "txt"])?
//! .exclude_paths(["content/private"])?;
//!
//! let workspace = Workspace::init_with_policy("my-content", policy)?;
//! Ok(())
//! }
//! ```
//!
//! # Variation metadata
//!
//! Variation names are stable Draftline identifiers. Hosts can attach display
//! metadata such as labels and slugs without changing the underlying name.
//!
//! ```no_run
//! use draftline::{VariationMetadata, Workspace};
//!
//! fn main() -> Result<(), draftline::DraftlineError> {
//! let workspace = Workspace::init("my-content")?;
//! let version = workspace.save_version("Initial draft")?;
//! let variation = workspace.create_variation_from_with_metadata(
//! version.id(),
//! "draft-a",
//! VariationMetadata::new()
//! .with_label("Draft A")
//! .with_slug("draft-a"),
//! )?;
//!
//! assert_eq!(variation.display_label(), "Draft A");
//! Ok(())
//! }
//! ```
//!
//! # Remote credentials
//!
//! Remote operations accept credential callbacks so host applications can
//! provide credentials from their own authentication flow.
//!
//! ```no_run
//! use draftline::{RemoteCredential, RemoteOptions, Workspace};
//!
//! fn main() -> Result<(), draftline::DraftlineError> {
//! let token = std::env::var("GITHUB_TOKEN").unwrap();
//! let mut options = RemoteOptions::new().with_credentials(move |request| {
//! if request.allows_username_password {
//! Ok(RemoteCredential::UsernamePassword {
//! username: "x-access-token".to_string(),
//! password: token.clone(),
//! })
//! } else {
//! Ok(RemoteCredential::Default)
//! }
//! });
//!
//! let workspace = Workspace::open("my-content")?;
//! workspace.fetch_remote_with_options("origin", &mut options)?;
//! Ok(())
//! }
//! ```
pub use ContentPolicy;
pub use ;
pub use ;
pub use ;
pub use ;