Skip to main content

EditAction

Enum EditAction 

Source
pub enum EditAction {
    Replace {
        inline: InlineOptions,
        find: String,
        at: Option<String>,
        story: Option<String>,
        occurrence: Option<usize>,
        all_matches: bool,
        expect_count: Option<usize>,
        payload: TextPayload,
    },
    Rewrite {
        inline: InlineOptions,
        at: String,
        payload: TextPayload,
    },
    Insert {
        inline: InlineOptions,
        kind: String,
        at: String,
        before_text: Option<String>,
        after_text: Option<String>,
        edge: Option<String>,
        position: Option<String>,
        occurrence: Option<usize>,
        payload: TextPayload,
    },
    Delete {
        inline: InlineOptions,
        at: String,
        find: Option<String>,
        whole_block: bool,
        occurrence: Option<usize>,
    },
    Apply {
        file: PathBuf,
        plan: PathBuf,
        allow_unbound_plan: bool,
        delivery: DeliveryOptions,
    },
}
Expand description

The initial PlanV2 text action profile.

Variants§

§

Replace

Replace exact literal text; without –at, search one declared story.

Fields

§inline: InlineOptions

Frozen policy and new-edit attribution.

§find: String

Exact nonempty literal text.

§at: Option<String>

Original paragraph ID from read; never silently retargeted.

§story: Option<String>

Search story when –at is omitted (default body).

§occurrence: Option<usize>

1-based exact match, including overlapping candidate starts.

§all_matches: bool

Replace every candidate; refuses when any two candidates overlap. Requires –expect-count.

§expect_count: Option<usize>

Required complete candidate count for –all-matches.

§payload: TextPayload

Exact text and optional attached comment.

§

Rewrite

Set exact desired paragraph text; an empty value retains the paragraph.

Fields

§inline: InlineOptions

Frozen policy and new-edit attribution.

§at: String

Original paragraph ID.

§payload: TextPayload

Exact text and optional attached comment.

§

Insert

Insert an explicitly typed text or paragraph payload.

Fields

§inline: InlineOptions

Frozen policy and new-edit attribution.

§kind: String

Object type; position never infers the kind.

§at: String

Original paragraph ID.

§before_text: Option<String>

Insert text before this exact nonempty literal.

§after_text: Option<String>

Insert text after this exact nonempty literal.

§edge: Option<String>

Insert text at a paragraph edge.

§position: Option<String>

Insert a paragraph beside the target paragraph.

§occurrence: Option<usize>

1-based literal candidate.

§payload: TextPayload

Exact text and optional attached comment.

§

Delete

Delete one exact range, or explicitly delete a whole paragraph.

Fields

§inline: InlineOptions

Frozen policy and new-edit attribution.

§at: String

Original paragraph ID; mandatory even for a range deletion.

§find: Option<String>

Exact nonempty literal range to remove.

§whole_block: bool

Explicit structural deletion (PlanV2 delete_paragraph).

§occurrence: Option<usize>

1-based literal candidate.

§

Apply

Apply only: never record into, consume, or rewrite the plan.

Fields

§file: PathBuf

Immutable source document.

§plan: PathBuf

Input plan; v2 policy and attribution belong exclusively to it.

§allow_unbound_plan: bool

Advanced v1-only waiver when neither plan nor CLI supplies a hash.

§delivery: DeliveryOptions

Publication and source preconditions.

Implementations§

Source§

impl EditAction

Source

pub fn name(&self) -> &'static str

Canonical action name for receipts.

Source

pub fn inline(&self) -> Option<&InlineOptions>

Inline policy, when this action compiles a new plan.

Source

pub fn inline_mut(&mut self) -> Option<&mut InlineOptions>

Inline policy, mutable, when this action compiles a new plan.

Source

pub fn author_was_given(&self) -> bool

Whether -a was spelled for this action. edit apply has none: the plan’s author is the signature.

Source

pub fn payload(&self) -> Option<&TextPayload>

Exact payload or resource input for actions with text.

Source

pub fn file(&self) -> &Path

Source path.

Source

pub fn delivery(&self) -> &DeliveryOptions

Delivery options, independent of plan-owned policy.

Trait Implementations§

Source§

impl Debug for EditAction

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl FromArgMatches for EditAction

Source§

fn from_arg_matches(__clap_arg_matches: &ArgMatches) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn from_arg_matches_mut( __clap_arg_matches: &mut ArgMatches, ) -> Result<Self, Error>

Instantiate Self from ArgMatches, parsing the arguments as needed. Read more
Source§

fn update_from_arg_matches( &mut self, __clap_arg_matches: &ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

fn update_from_arg_matches_mut<'b>( &mut self, __clap_arg_matches: &mut ArgMatches, ) -> Result<(), Error>

Assign values from ArgMatches to self.
Source§

impl Serialize for EditAction

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Subcommand for EditAction

Source§

fn augment_subcommands<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate Self via FromArgMatches::from_arg_matches_mut Read more
Source§

fn augment_subcommands_for_update<'b>(__clap_app: Command) -> Command

Append to Command so it can instantiate self via FromArgMatches::update_from_arg_matches_mut Read more
Source§

fn has_subcommand(__clap_name: &str) -> bool

Test whether Self can parse a specific subcommand

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.