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

Refactored and added an undo feature #79

Closed
wants to merge 17 commits into from
Closed

Conversation

jyn514
Copy link

@jyn514 jyn514 commented Jul 19, 2017

Major changes:
When run without arguments, give a help message
Never organize current directory unless prompted to
Change short form of options to be one character (in most cases)
Changed option -d (formerly directory) to mean date.
Directory is now a mandatory positional argument
Added an undo feature using gitpython

Minor changes:
Arrow is now imported only when the -d (date) option is used
If arrow is not installed, datetime is used instead
Added CLI interface to replace unused function main()
Made default config a constant

Config:
Added many, many different file extensions
Made Packages one category (previously DEBPackages and RPMPackges)
Changed 'Music' to 'Audio'
Added new extension categories:
Programming
Plain Text
Webpages
Ringtones
Added to sources a wikipedia page with new extensions

Readme:
Updated options to match parser help
Pasted literals of classifier in use

Formatting:
Converted tabs to spaces
Added a shebang
Reduced line lengths across the board
Removed some whitespace

jyn514 added 9 commits July 19, 2017 10:16
…fig()

Added category 'Plain Text' and moved some formats to it from Documents
Added Programmng category (contains output and source);
Added Plain Text category;
Consolidated packages into a single category;
Added Ringtones category;
Added Webpages category;
Changed category Music to Audio;
Added many file formats
Changed options in readme to output of `classifier -h`;
Changed tabs to spaces, reduced line lengths;

Classifier:
Added try/catch to import module 'arrow';
Added command-line interface (if __name__==__main__);
Changed default behavior - if directory not specified, show help;
Changed default behavior - if output not specified, use input;
Changed all calls of sys.exit() to quit();
Removed uncalled function main();
Changed options to be more in line with coreutils style;
Made default config a global constant.
Updated usage example to reflect new default behavior;

Classifier:
Changed most options to be a single letter;
Misc formatting.
@jyn514
Copy link
Author

jyn514 commented Jul 19, 2017

I know this is a ton of changes. I don't mind if you only accept the minor ones (although I don't know how to make Github show only some commits).

My reasoning behind changing the default was that I kept accidentally moving my own directory around while I was working on the project. Previously, it would organize your directory every time it was called unless specifically told not to with -d, -ed, or -v. I wanted to go with the principle of least surprise.

@jyn514
Copy link
Author

jyn514 commented Jul 19, 2017

This closes issues #49 (No programming categories), #41 (Undo feature request) and #76 (Arrow dependency)

jyn514 and others added 5 commits July 20, 2017 18:54
Updated usage section to match changed behavior;
Updated options list;
Minor edits;

Classifier:
Made `directory` a required argument in `argparse`;
Greatly restructured flow control in classify();
Removed unused help message;
Removed redundant _format_arg function;
Removed redundant IGNORE sections;
Added verbose option - default is now quiet;
Changed variable name back to 'directory';
Made try/catch loops noisy on failure;
Changed many 'return False' statements to quit();
Minor formatting edits;
Minor edits
Imported entire sys module;
Made arguments optional to allow -v, -h, etc;
Re-added help message (for when called without an argument);
Removed troublesome new-line in DEFAULT, will need to be fixed at some point;
Fixed NameError;
Enabled date formatting without arrow installed;
Made config option more consistant;
Added error message if given directory does not exist;
More flow control (custom, date, and default)
Added --undo option

Classifier:
Added a save function!
Added an undo function;
Added --no-save option;
Added 'no files' message for dates;
TODO: add 'no files' for all;
Misc formatting
@jyn514 jyn514 changed the title Changed default behavior options Refactored and added an undo feature Jul 23, 2017
jyn514 added 3 commits July 28, 2017 17:00
added options function;
made directory a class variable;
save function now creates its own git branch;
used git.Repo.iter_commits to simplify;
removed some error shadowing;
added more checks for output directory;
undo now checks if git repo is bare;
removed some exclamation marks;
misc whitespace and commenting
changed conf location to .local (on linux);
added various checks for git;
undo now removes empty folders it created;
used argparse's builtin version command;
added class variables git_imported, has_commits;
main uses class variables instead of arguments (mostly);
fixed syntax errors (date_no_arrow and options);
warned about semantic error with -F and -T (bugfix pending)
@jyn514 jyn514 closed this Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant