MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / from_args

Method from_args

src/sessions/git_correlation.rs:227–249  ·  view source on GitHub ↗

Builds a validated filter from raw optional argument strings.

(
        branch: Option<&str>,
        worktree: Option<&str>,
        commit: Option<&str>,
    )

Source from the content-addressed store, hash-verified

225impl GitScopeFilter {
226 /// Builds a validated filter from raw optional argument strings.
227 pub fn from_args(
228 branch: Option<&str>,
229 worktree: Option<&str>,
230 commit: Option<&str>,
231 ) -> Result<Self, GitCorrelationError> {
232 let branch = branch
233 .map(str::trim)
234 .filter(|value| !value.is_empty())
235 .map(str::to_string);
236 let worktree = worktree
237 .map(str::trim)
238 .filter(|value| !value.is_empty())
239 .map(normalize_worktree);
240 let commit = match commit.map(str::trim).filter(|value| !value.is_empty()) {
241 Some(value) => Some(parse_commit_sha(value)?),
242 None => None,
243 };
244 Ok(Self {
245 branch,
246 worktree,
247 commit,
248 })
249 }
250
251 pub const fn is_empty(&self) -> bool {
252 self.branch.is_none() && self.worktree.is_none() && self.commit.is_none()

Callers

nothing calls this directly

Calls 2

parse_commit_shaFunction · 0.85
is_emptyMethod · 0.45

Tested by

no test coverage detected