Skip to content

Commit

Permalink
Merge pull request #191 from azriel91/feature/182/web-ui-cmd-invocations
Browse files Browse the repository at this point in the history
  • Loading branch information
azriel91 authored May 26, 2024
2 parents ff39e26 + 3323ef7 commit c19100c
Show file tree
Hide file tree
Showing 91 changed files with 2,831 additions and 1,572 deletions.
2 changes: 2 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[profile.default]
leak-timeout = "500ms"
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@

## unreleased

* Move `Cli*` types to `peace_cli` crate under `cli::output` module. ([#182])
* Move `OutputFormat` and `OutputFormatParseError` to `peace_cli_model` crate. ([#182])
* Move `Cli*` types to `peace_cli` crate under `cli::output` module. ([#182], [#189])
* Move `OutputFormat` and `OutputFormatParseError` to `peace_cli_model` crate. ([#182], [#189])
* Render progress and outcome diagram using `dot_ix`. ([#182], [#189], [#191])


[#182]: https://github.com/azriel91/peace/issues/182
[#189]: https://github.com/azriel91/peace/pull/189
[#191]: https://github.com/azriel91/peace/pull/191


## 0.0.13 (2024-02-03)
Expand Down
11 changes: 9 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ categories.workspace = true
keywords.workspace = true
license.workspace = true

[lints]
workspace = true

[lib]
doctest = true
test = false
Expand Down Expand Up @@ -151,7 +154,7 @@ console = "0.15.8"
derivative = "2.2.0"
diff-struct = "0.5.3"
downcast-rs = "1.2.0"
dot_ix = { version = "0.4.1", default-features = false }
dot_ix = { version = "0.5.0", default-features = false }
dyn-clone = "1.0.17"
enser = "0.1.4"
erased-serde = "0.4.3"
Expand All @@ -160,13 +163,14 @@ futures = "0.3.30"
heck = "0.4.1"
indexmap = "2.2.5"
indicatif = "0.17.8"
interruptible = "0.2.1"
interruptible = "0.2.2"
leptos = { version = "0.6" }
leptos_axum = "0.6"
leptos_meta = { version = "0.6" }
leptos_router = { version = "0.6" }
libc = "0.2.153"
miette = "7.2.0"
own = "0.1.0"
pretty_assertions = "1.4.0"
proc-macro2 = "1.0.78"
quote = "1.0.35"
Expand All @@ -189,3 +193,6 @@ type_reg = { version = "0.7.0", features = ["debug", "untagged", "ordered"] }
url = "2.5.0"
wasm-bindgen = "0.2.92"
web-sys = "0.3.69"

[workspace.lints.rust]
unexpected_cfgs = { level = "warn", check-cfg = ['cfg(coverage_nightly)'] }
3 changes: 3 additions & 0 deletions crate/cfg/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ categories.workspace = true
keywords.workspace = true
license.workspace = true

[lints]
workspace = true

[lib]
doctest = false
test = false
Expand Down
3 changes: 3 additions & 0 deletions crate/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ categories.workspace = true
keywords.workspace = true
license.workspace = true

[lints]
workspace = true

[lib]
doctest = true
test = false
Expand Down
4 changes: 3 additions & 1 deletion crate/cli/src/output/cli_output.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
use std::fmt::{self, Debug};
#[cfg(unix)]
use std::fmt;
use std::fmt::Debug;

use peace_cli_model::OutputFormat;
use peace_fmt::Presentable;
Expand Down
3 changes: 3 additions & 0 deletions crate/cli_model/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ categories.workspace = true
keywords.workspace = true
license.workspace = true

[lints]
workspace = true

[lib]
doctest = true
test = false
Expand Down
4 changes: 4 additions & 0 deletions crate/cmd/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ categories.workspace = true
keywords.workspace = true
license.workspace = true

[lints]
workspace = true

[lib]
doctest = false
test = false
Expand All @@ -21,6 +24,7 @@ cfg-if = { workspace = true }
futures = { workspace = true }
indicatif = { workspace = true, optional = true, features = ["tokio"] }
interruptible = { workspace = true, features = ["stream"] }
own = { workspace = true }
peace_cfg = { workspace = true }
peace_code_gen = { workspace = true }
peace_core = { workspace = true }
Expand Down
21 changes: 11 additions & 10 deletions crate/cmd/src/ctx/cmd_ctx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

use std::ops::{Deref, DerefMut};

use own::{OwnedOrMutRef, OwnedOrRef};
use peace_rt_model::Workspace;

use crate::ctx::{
Expand Down Expand Up @@ -38,8 +39,8 @@ impl<Scope> CmdCtx<Scope> {
impl CmdCtx<()> {
/// Returns a `CmdCtxBuilder` for a single profile and no flow.
pub fn builder_no_profile_no_flow<'ctx, AppError, Output>(
output: &'ctx mut Output,
workspace: &'ctx Workspace,
output: OwnedOrMutRef<'ctx, Output>,
workspace: OwnedOrRef<'ctx, Workspace>,
) -> CmdCtxBuilder<
'ctx,
CmdCtxTypesCollectorEmpty<AppError, Output>,
Expand All @@ -50,8 +51,8 @@ impl CmdCtx<()> {

/// Returns a `CmdCtxBuilder` for multiple profiles and no flow.
pub fn builder_multi_profile_no_flow<'ctx, AppError, Output>(
output: &'ctx mut Output,
workspace: &'ctx Workspace,
output: OwnedOrMutRef<'ctx, Output>,
workspace: OwnedOrRef<'ctx, Workspace>,
) -> CmdCtxBuilder<
'ctx,
CmdCtxTypesCollectorEmpty<AppError, Output>,
Expand All @@ -62,8 +63,8 @@ impl CmdCtx<()> {

/// Returns a `CmdCtxBuilder` for multiple profiles and one flow.
pub fn builder_multi_profile_single_flow<'ctx, AppError, Output>(
output: &'ctx mut Output,
workspace: &'ctx Workspace,
output: OwnedOrMutRef<'ctx, Output>,
workspace: OwnedOrRef<'ctx, Workspace>,
) -> CmdCtxBuilder<
'ctx,
CmdCtxTypesCollectorEmpty<AppError, Output>,
Expand All @@ -74,8 +75,8 @@ impl CmdCtx<()> {

/// Returns a `CmdCtxBuilder` for a single profile and flow.
pub fn builder_single_profile_no_flow<'ctx, AppError, Output>(
output: &'ctx mut Output,
workspace: &'ctx Workspace,
output: OwnedOrMutRef<'ctx, Output>,
workspace: OwnedOrRef<'ctx, Workspace>,
) -> CmdCtxBuilder<
'ctx,
CmdCtxTypesCollectorEmpty<AppError, Output>,
Expand All @@ -86,8 +87,8 @@ impl CmdCtx<()> {

/// Returns a `CmdCtxBuilder` for a single profile and flow.
pub fn builder_single_profile_single_flow<'ctx, AppError, Output>(
output: &'ctx mut Output,
workspace: &'ctx Workspace,
output: OwnedOrMutRef<'ctx, Output>,
workspace: OwnedOrRef<'ctx, Workspace>,
) -> CmdCtxBuilder<
'ctx,
CmdCtxTypesCollectorEmpty<AppError, Output>,
Expand Down
5 changes: 3 additions & 2 deletions crate/cmd/src/ctx/cmd_ctx_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{fmt::Debug, hash::Hash};

use futures::stream::{StreamExt, TryStreamExt};
use interruptible::Interruptibility;
use own::{OwnedOrMutRef, OwnedOrRef};
use peace_cfg::ItemId;
use peace_params::ParamsSpecs;
use peace_resources::{
Expand Down Expand Up @@ -48,11 +49,11 @@ where
/// See [`OutputWrite`].
///
/// [`OutputWrite`]: peace_rt_model_core::OutputWrite
output: &'ctx mut CmdCtxBuilderTypesT::Output,
output: OwnedOrMutRef<'ctx, CmdCtxBuilderTypesT::Output>,
/// The interrupt channel receiver if this `CmdExecution` is interruptible.
interruptibility: Interruptibility<'static>,
/// Workspace that the `peace` tool runs in.
workspace: &'ctx Workspace,
workspace: OwnedOrRef<'ctx, Workspace>,
/// Data held while building `CmdCtx`.
scope_builder: ScopeBuilder,
}
Expand Down
15 changes: 8 additions & 7 deletions crate/cmd/src/scopes/multi_profile_no_flow.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{collections::BTreeMap, fmt::Debug, hash::Hash};

use interruptible::InterruptibilityState;
use own::{OwnedOrMutRef, OwnedOrRef};
use peace_core::Profile;
use peace_resources::paths::{PeaceAppDir, PeaceDir, ProfileDir, ProfileHistoryDir, WorkspaceDir};
use peace_rt_model::{
Expand Down Expand Up @@ -60,13 +61,13 @@ where
/// See [`OutputWrite`].
///
/// [`OutputWrite`]: peace_rt_model_core::OutputWrite
output: &'ctx mut CmdCtxTypesT::Output,
output: OwnedOrMutRef<'ctx, CmdCtxTypesT::Output>,
/// Whether the `CmdExecution` is interruptible.
///
/// If it is, this holds the interrupt channel receiver.
interruptibility_state: InterruptibilityState<'static, 'static>,
/// Workspace that the `peace` tool runs in.
workspace: &'ctx Workspace,
workspace: OwnedOrRef<'ctx, Workspace>,
/// The profiles that are accessible by this command.
profiles: Vec<Profile>,
/// Profile directories that store params and flows.
Expand Down Expand Up @@ -179,9 +180,9 @@ where
/// Returns a new `MultiProfileNoFlow` scope.
#[allow(clippy::too_many_arguments)] // Constructed by proc macro
pub(crate) fn new(
output: &'ctx mut CmdCtxTypesT::Output,
output: OwnedOrMutRef<'ctx, CmdCtxTypesT::Output>,
interruptibility_state: InterruptibilityState<'static, 'static>,
workspace: &'ctx Workspace,
workspace: OwnedOrRef<'ctx, Workspace>,
profiles: Vec<Profile>,
profile_dirs: BTreeMap<Profile, ProfileDir>,
profile_history_dirs: BTreeMap<Profile, ProfileHistoryDir>,
Expand Down Expand Up @@ -240,12 +241,12 @@ where

/// Returns a reference to the output.
pub fn output(&self) -> &CmdCtxTypesT::Output {
self.output
&self.output
}

/// Returns a mutable reference to the output.
pub fn output_mut(&mut self) -> &mut CmdCtxTypesT::Output {
self.output
&mut self.output
}

/// Returns the interruptibility capability.
Expand All @@ -255,7 +256,7 @@ where

/// Returns the workspace that the `peace` tool runs in.
pub fn workspace(&self) -> &Workspace {
self.workspace
&self.workspace
}

/// Returns a reference to the workspace directory.
Expand Down
15 changes: 8 additions & 7 deletions crate/cmd/src/scopes/multi_profile_single_flow.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{collections::BTreeMap, fmt::Debug, hash::Hash};

use interruptible::InterruptibilityState;
use own::{OwnedOrMutRef, OwnedOrRef};
use peace_core::Profile;
use peace_params::ParamsSpecs;
use peace_resources::{
Expand Down Expand Up @@ -83,13 +84,13 @@ where
/// See [`OutputWrite`].
///
/// [`OutputWrite`]: peace_rt_model_core::OutputWrite
output: &'ctx mut CmdCtxTypesT::Output,
output: OwnedOrMutRef<'ctx, CmdCtxTypesT::Output>,
/// Whether the `CmdExecution` is interruptible.
///
/// If it is, this holds the interrupt channel receiver.
interruptibility_state: InterruptibilityState<'static, 'static>,
/// Workspace that the `peace` tool runs in.
workspace: &'ctx Workspace,
workspace: OwnedOrRef<'ctx, Workspace>,
/// The profiles that are accessible by this command.
profiles: Vec<Profile>,
/// Profile directories that store params and flows.
Expand Down Expand Up @@ -229,9 +230,9 @@ where
/// Returns a new `MultiProfileSingleFlow` scope.
#[allow(clippy::too_many_arguments)] // Constructed by proc macro
pub(crate) fn new(
output: &'ctx mut CmdCtxTypesT::Output,
output: OwnedOrMutRef<'ctx, CmdCtxTypesT::Output>,
interruptibility_state: InterruptibilityState<'static, 'static>,
workspace: &'ctx Workspace,
workspace: OwnedOrRef<'ctx, Workspace>,
profiles: Vec<Profile>,
profile_dirs: BTreeMap<Profile, ProfileDir>,
profile_history_dirs: BTreeMap<Profile, ProfileHistoryDir>,
Expand Down Expand Up @@ -337,12 +338,12 @@ where

/// Returns a reference to the output.
pub fn output(&self) -> &CmdCtxTypesT::Output {
self.output
&self.output
}

/// Returns a mutable reference to the output.
pub fn output_mut(&mut self) -> &mut CmdCtxTypesT::Output {
self.output
&mut self.output
}

/// Returns the interruptibility capability.
Expand All @@ -352,7 +353,7 @@ where

/// Returns the workspace that the `peace` tool runs in.
pub fn workspace(&self) -> &Workspace {
self.workspace
&self.workspace
}

/// Returns a reference to the workspace directory.
Expand Down
15 changes: 8 additions & 7 deletions crate/cmd/src/scopes/no_profile_no_flow.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use std::{fmt::Debug, hash::Hash};

use interruptible::InterruptibilityState;
use own::{OwnedOrMutRef, OwnedOrRef};
use peace_resources::paths::{PeaceAppDir, PeaceDir, WorkspaceDir};
use peace_rt_model::{
params::{KeyKnown, KeyMaybe, ParamsKeys, ParamsKeysImpl, ParamsTypeRegs, WorkspaceParams},
Expand Down Expand Up @@ -43,13 +44,13 @@ where
/// See [`OutputWrite`].
///
/// [`OutputWrite`]: peace_rt_model_core::OutputWrite
output: &'ctx mut CmdCtxTypesT::Output,
output: OwnedOrMutRef<'ctx, CmdCtxTypesT::Output>,
/// Whether the `CmdExecution` is interruptible.
///
/// If it is, this holds the interrupt channel receiver.
interruptibility_state: InterruptibilityState<'static, 'static>,
/// Workspace that the `peace` tool runs in.
workspace: &'ctx Workspace,
workspace: OwnedOrRef<'ctx, Workspace>,
/// Type registries for [`WorkspaceParams`], [`ProfileParams`], and
/// [`FlowParams`] deserialization.
///
Expand All @@ -68,9 +69,9 @@ where
CmdCtxTypesT: CmdCtxTypes,
{
pub(crate) fn new(
output: &'ctx mut CmdCtxTypesT::Output,
output: OwnedOrMutRef<'ctx, CmdCtxTypesT::Output>,
interruptibility_state: InterruptibilityState<'static, 'static>,
workspace: &'ctx Workspace,
workspace: OwnedOrRef<'ctx, Workspace>,
params_type_regs: ParamsTypeRegs<CmdCtxTypesT::ParamsKeys>,
workspace_params: WorkspaceParams<
<<CmdCtxTypesT::ParamsKeys as ParamsKeys>::WorkspaceParamsKMaybe as KeyMaybe>::Key,
Expand All @@ -87,12 +88,12 @@ where

/// Returns a reference to the output.
pub fn output(&self) -> &CmdCtxTypesT::Output {
self.output
&self.output
}

/// Returns a mutable reference to the output.
pub fn output_mut(&mut self) -> &mut CmdCtxTypesT::Output {
self.output
&mut self.output
}

//// Returns the interruptibility capability.
Expand All @@ -102,7 +103,7 @@ where

/// Returns the workspace that the `peace` tool runs in.
pub fn workspace(&self) -> &Workspace {
self.workspace
&self.workspace
}

/// Returns a reference to the workspace directory.
Expand Down
Loading

0 comments on commit c19100c

Please sign in to comment.