Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ignore prompt flag. Sync .bsync-ignore files. #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Usage: bsync [options] DIR1 DIR2
DIR can be user@sshserver:DIR
-v Verbose
-i Ignore permissions
-y Ignore confirm changes prompt
-b Batch mode (exit on conflict)
-p PORT Port for SSH
-o SSHARGS Custom options for SSH
```
Expand Down
11 changes: 8 additions & 3 deletions bsync
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def get_ignores(ignorefile, ssh,dirname):
# returns True if the path has to be ignored
# ignore root path and .bsync files
def ignorepath(path, ignoreset):
if path == b"" or path.startswith(b".bsync-"):
if path == b"" or path.startswith(b".bsync-snap"):
return True
else:
for ignore in ignoreset:
Expand Down Expand Up @@ -739,6 +739,7 @@ def usage():
usage+= " DIR can be user@sshserver:DIR\n"
usage+= " -v Verbose\n"
usage+= " -i Ignore permissions\n"
usage+= " -y Ignore confirm changes prompt\n"
usage+= " -b Batch mode (exit on conflict)\n"
usage+= " -p PORT Port for SSH\n"
usage+= " -o SSHARGS Custom options for SSH\n"
Expand All @@ -748,20 +749,22 @@ def usage():

#### process commandline args
try:
opts, args = getopt.gnu_getopt(sys.argv[1:], "vcibp:o:")
opts, args = getopt.gnu_getopt(sys.argv[1:], "vycibp:o:")
except getopt.GetoptError as err:
printerr(err)
usage()
sys.exit(2)

verbose = check = ignoreperms = noninteractive = False
yes = verbose = check = ignoreperms = noninteractive = False
sshport = None
sshargs = ""
for o, a in opts:
if o == "-v":
verbose = True
elif o == "-i":
ignoreperms = True
elif o == "-y":
yes = True
elif o == "-c":
check = True
elif o == "-p":
Expand Down Expand Up @@ -1023,6 +1026,8 @@ print("Todo in "+args[0]+": "+get_dir_summary(mkdir1,moves1,rm1,rmdirs1, copy21,
print("Todo in "+args[1]+": "+get_dir_summary(mkdir2,moves2,rm2,rmdirs2, copy12,sync12))

resp = "none"
if yes:
resp = "y"
while resp != "y" and resp != "n":
resp = myinput("Apply actions? [y/N] ").lower()
if resp == "": resp = "n"
Expand Down