Skip to content
This repository has been archived by the owner on Mar 10, 2018. It is now read-only.

File is overwritten if you don't use a -f flag #7

Open
jellelicht opened this issue Feb 28, 2012 · 3 comments
Open

File is overwritten if you don't use a -f flag #7

jellelicht opened this issue Feb 28, 2012 · 3 comments
Assignees
Labels
Milestone

Comments

@jellelicht
Copy link

The invocation python C3P file.txt will erase the contents of file.txt
This is a easy typo to make, and it isn't even useful behaviour.

@ghost ghost assigned Apanatshka Feb 28, 2012
@Apanatshka
Copy link
Owner

Thanks @wordempire!
I agree that it's a bug. I'll try to fix it soon.

@jellelicht
Copy link
Author

perhaps you could include a -F Force flag that will make C3P overwrite any file without question.
Without -F C3P should always ask for confirmation before opening (and possibly overwriting) an existing file.

This would also mean that the unwashed masses can't have their files overwritten if they forget the -f flag;
Accidents can only happen if -F is included, which would of course be the sole responsibility of the user (rm -rf anyone?)

Apanatshka added a commit that referenced this issue Mar 4, 2012
…th shebang functionality. This should also fix the problem in #7 for the most part. I still want to look at the possibility of a -F force flag for overwriting existing files.

Created system to subdivide commands for reading but not executing within if/else structure.
Made sure normal empty lines get into the output.
Refined number recognition.
Fixed #8.

Signed-off-by: Jeff <[email protected]>
@Apanatshka
Copy link
Owner

I've just changed the order of the flags in commit 5de7967. The input file is the positional argument at the end (the destination file is given with a -d flag). So this problem of accidental overwrite because of a missing flag will not be a problem anymore.
The reason for changing that order is mostly to do with my wish for this tool to be useful in a shebang (#!).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants