Skip to content

UX: conflicts show path argument is confusing — should accept relative dotfile paths #9

Description

@piranhap

Summary

opendotsync conflicts show <path> requires the relative dotfile path (e.g. .bashrc) but users naturally pass absolute paths or home-relative paths, all of which fail with a misleading error.

Observed Behaviour

opendotsync conflicts show ~/.bashrc     # Error: IO error: no conflicts found
opendotsync conflicts show .bashrc       # Error: IO error: no conflicts found  (if no active conflict)
opendotsync conflicts show /home/test1/.bashrc  # Error: IO error: no conflicts found

conflicts list shows the correct path to use, but the error message gives no hint.

Expected Behaviour

  1. Accept absolute paths and home-relative paths by stripping the home dir prefix before lookup.
  2. When no conflict exists for the given path, say so clearly: No conflict stashed for '.bashrc'. Run 'conflicts list' to see active conflicts.
  3. conflicts list with no active conflicts should suggest opendotsync pull to check for remote changes.

Implementation

In cmd_conflicts_show (src/sync.rs), normalize the path argument:

// Strip home dir prefix if present
let rel_path = if path.starts_with(home_dir) {
    path.strip_prefix(home_dir)?.to_str()?
} else {
    path.trim_start_matches('/')
};

Improve the error message from the generic IO error to a targeted SyncError::NoConflict(path) variant.

Affected Files

  • src/sync.rscmd_conflicts_show(), cmd_conflicts_accept_local(), cmd_conflicts_accept_remote()
  • src/sync.rs — add SyncError::NoConflict(String) variant

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingux

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions