Skip to content

Commit

Permalink
Implement unlinked fragments, improve the codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
nekitdev committed Aug 25, 2024
1 parent 58003d8 commit 371ab3d
Show file tree
Hide file tree
Showing 15 changed files with 405 additions and 260 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,22 @@ $ changelogging create --content "Added cool features!" 13.feature.md
$ changelogging create --content "Fixed annoying bugs!" 64.fix.md
```

There are also *unlinked* fragments, which have non-integer IDs:

```console
$ changelogging create --content "Fixed security issues!" ~issue.security.md
```

And finally, preview the changelog entry!

```console
$ changelogging preview
## 0.4.4 (YYYY-MM-DD)

### Security

- Fixed security issues!

### Features

- Added cool features! (#13)
Expand Down Expand Up @@ -133,6 +143,10 @@ $ cat CHANGELOG.md

## 0.4.4 (YYYY-MM-DD)

### Security

- Fixed security issues!

### Features

- Added cool features! (#13)
Expand Down
24 changes: 12 additions & 12 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ use crate::{
commands::{build::build, create::create, preview::preview},
discover::discover,
init::init,
workspace::{load, Workspace},
load::load,
workspace::Workspace,
};

/// Represents global options of `changelogging`.
Expand Down Expand Up @@ -146,27 +147,26 @@ impl App {
pub fn run(self) -> Result<(), Error> {
let globals = self.globals;

init(globals.directory).map_err(|error| Error::init(error))?;
init(globals.directory).map_err(Error::init)?;

let workspace = match globals.config {
Some(path) => load(path).map_err(|error| Error::workspace(error))?,
None => discover().map_err(|error| Error::discover(error))?,
let workspace = if let Some(path) = globals.config {
load(path).map_err(Error::workspace)?
} else {
discover().map_err(Error::discover)?
};

if let Some(command) = self.command {
match command {
Command::Build(build) => {
build.run(workspace).map_err(|error| Error::build(error))?
build.run(workspace).map_err(Error::build)?;
}
Command::Preview(preview) => {
preview.run(workspace).map_err(Error::preview)?;
}
Command::Preview(preview) => preview
.run(workspace)
.map_err(|error| Error::preview(error))?,
Command::Create(create) => {
let directory = workspace.config.paths.directory;

create
.run(directory)
.map_err(|error| Error::create(error))?;
create.run(directory).map_err(Error::create)?;
}
}
};
Expand Down
Loading

0 comments on commit 371ab3d

Please sign in to comment.