iansedano / dot-dropbox-ignore

A cross-platform utility to ignore Dropbox files and folders from sync.
MIT License
1 stars 1 forks source link

darwin compatibility #5

Open fensoft opened 2 months ago

fensoft commented 2 months ago

I think there is a typo here: https://github.com/iansedano/dot-dropbox-ignore/blob/master/dropboxignore/shell.py#L22 "raise Bash_shell()"

This should be "return Bash_shell()", right ?

iansedano commented 2 months ago

Thanks for raising that!

That does indeed look like a typo. Not sure what happened there. I'll see about fixing that up as soon as I am able.

fensoft commented 2 months ago

looks like it's not working in mac, as it's xattr instead of attr:

usage: xattr [-l] [-r] [-s] [-v] [-x] file [file ...]
       xattr -p [-l] [-r] [-s] [-v] [-x] attr_name file [file ...]
       xattr -w [-r] [-s] [-x] attr_name attr_value file [file ...]
       xattr -d [-r] [-s] attr_name file [file ...]
       xattr -c [-r] [-s] file [file ...]

The first form lists the names of all xattrs on the given file(s).
The second form (-p) prints the value of the xattr attr_name.
The third form (-w) sets the value of the xattr attr_name to the string attr_value.
The fourth form (-d) deletes the xattr attr_name.
The fifth form (-c) deletes (clears) all xattrs.

options:
  -h: print this help
  -l: print long format (attr_name: attr_value and hex output has offsets and
      ascii representation)
  -r: act recursively
  -s: act on the symbolic link itself rather than what the link points to
  -v: also print filename (automatic with -r and with multiple files)
  -x: attr_value is represented as a hex string for input and output

see here: https://github.com/sp1thas/dropboxignore/blob/master/src/dropboxignore/ignorer.py#L54

iansedano commented 2 months ago

Thanks for testing this!

Will add in a check for attr and fallback to xattr.

iansedano commented 2 months ago

I ended up adding a new Shell runner for Mac, assuming Zsh, and assuming xattr.

The right thing would be to add in more advanced handling to ensure that attr or xattr are available, but for now this should fix your issue.

If you are able to test it by checking out #6, that'd be great (I have no Macs to test with). But if I don't hear from you in a couple days I'll merge this and push up the new version to PyPI.

Cheers!

fensoft commented 2 months ago

it's -w not -V to set the attribute

iansedano commented 2 months ago

Thanks for taking a look!

I've taken a closer look at the usage doc you provided and have updated the shell commands.