feat: sync optional path argument #21
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "sync-path-arg"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Add an optional
pathargument to thesynccommand to specify which paths to sync.It will default to
everything.Addressing Issue: #18
Test
Sync without paths (no breaking changes)
new.txtshould be committed.Sync directory
Only the changes inside
folder/new.txtshould be committed.Sync file
Only the changes inside
new.txtshould be committed.Sync (from subdir)
Only the changes inside
subdir/new.txtshould be committed.Sync (parent from subdir)
Only the changes inside
parent.txtshould be committed.WIP: feat:to feat:syncoptional path argumentsyncoptional path argumentfeat:to WIP: feat:syncoptional path argumentsyncoptional path argumentWIP: feat:to feat:syncoptional path argumentsyncoptional path argumentNur ein paar Kleinigkeiten
@ -36,6 +36,10 @@ pub struct Cmd {#[arg(long, default_value = "false")]/// this will ignore checks for unresolved merge conflictsallow_unresolved: bool,#[arg(short, long)]/// specifing a path will only sync the given pathpath: Option<String>,Ich glaube man kann irgendwie auch hier gleich in clap schon PathBufs expecten. Dann macht es sogar ein paar extra checks beim parsen wenn ich mich recht erinnere und du sparst dir die conversion später
@ -68,19 +71,23 @@ mod commit {pub fn save_changes(repo: &Repository,commit_message: &str,path: &Option<String>,allow_unresolved: bool,) -> anyhow::Result<()> {let status = git_status::StatusReport::new(&repo)?;let status = git_status::StatusReport::new(&repo, &path)?;// error out when there are merge conflictsif !allow_unresolved {status.assume_no_conflicts()?;}let cwd = git_root()?;let path = match path {Geschmackssache: Das kann man kürzer schreiben als
path.unrwap_or("."). Wahrscheinlich geht es nicht, weil die types nicht ganz passen und es wäre vorerst pain das zu fixen. Deswegen lass es ruhig. Will dir nur mal die Funktionalitäten derstdlib langsam zeigenSollte verbessert sein in diesem commit
Sieht gut aus! :)