-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix subcommand or flag handling - use fire module for subcommand handler - change flags to subcommand * change commands or help format - use tabulate for help or listing commands * added feature: copying directory to clipboard - use pyperclip for copying dir to clipboard
- Loading branch information
1 parent
304dccc
commit dd9685c
Showing
61 changed files
with
101 additions
and
32 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
tabulate==0.9.0 | ||
fire==0.4.0 | ||
pyperclip==1.8.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,36 @@ | ||
import sys | ||
from src.sdir import * | ||
help = ''' | ||
SDIR - saved directory | ||
use these flags: -s,-r,-ra,-l | ||
-s\t\tsave current directory | ||
-r\t\tremove a directory | ||
-ra\t\tremove all saved directory | ||
-l\t\tlist all saved directory | ||
''' | ||
def main(): | ||
db = DB() | ||
args = sys.argv | ||
create_table_once(db) | ||
try: | ||
cmd = args[1] | ||
from lib.sdir import * | ||
import fire | ||
from tabulate import tabulate | ||
|
||
if cmd == "-s": | ||
save_dir(db) | ||
|
||
elif cmd == "-r": | ||
id = args[2] | ||
remove_dir(db,id) | ||
def main(cmd=None, id=None): | ||
db = DB() | ||
create_table_once(db) | ||
|
||
if cmd == "save": | ||
save_dir(db) | ||
elif cmd == "remove" and id is not None: | ||
remove_dir(db, id) | ||
elif cmd == "remove-all": | ||
remove_dir_all(db) | ||
elif cmd == "list": | ||
list_dir(db) | ||
elif cmd == "clip" and id is not None: | ||
copy_path_to_clip(db, id) | ||
else: | ||
help_table = [ | ||
["Command", "Description"], | ||
["save", "Save the current directory."], | ||
["remove [id]", "Remove a saved directory by its ID."], | ||
["remove-all", "Remove all saved directories."], | ||
["list", "List all saved directories."], | ||
["clip [id]", "Copy the path of a saved directory to the clipboard."] | ||
] | ||
print("SDIR - Saved Directory") | ||
print(tabulate(help_table, headers="firstrow", tablefmt="plain")) | ||
print("\nAuthor: Mark Wayne Menorca") | ||
print("GitHub: https://github.com/marcuwynu23/sdir") | ||
|
||
elif cmd == "-ra": | ||
remove_dir_all(db) | ||
|
||
elif cmd == "-l": | ||
list_dir(db) | ||
else: | ||
print(help) | ||
|
||
except IndexError as err: | ||
print(help) | ||
|
||
if __name__ == '__main__': | ||
main() | ||
fire.Fire(main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# -*- mode: python ; coding: utf-8 -*- | ||
|
||
|
||
block_cipher = None | ||
|
||
|
||
a = Analysis( | ||
['sdir.py'], | ||
pathex=[], | ||
binaries=[], | ||
datas=[], | ||
hiddenimports=[], | ||
hookspath=[], | ||
hooksconfig={}, | ||
runtime_hooks=[], | ||
excludes=[], | ||
win_no_prefer_redirects=False, | ||
win_private_assemblies=False, | ||
cipher=block_cipher, | ||
noarchive=False, | ||
) | ||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) | ||
|
||
exe = EXE( | ||
pyz, | ||
a.scripts, | ||
[], | ||
exclude_binaries=True, | ||
name='sdir', | ||
debug=False, | ||
bootloader_ignore_signals=False, | ||
strip=False, | ||
upx=True, | ||
console=True, | ||
disable_windowed_traceback=False, | ||
argv_emulation=False, | ||
target_arch=None, | ||
codesign_identity=None, | ||
entitlements_file=None, | ||
) | ||
coll = COLLECT( | ||
exe, | ||
a.binaries, | ||
a.zipfiles, | ||
a.datas, | ||
strip=False, | ||
upx=True, | ||
upx_exclude=[], | ||
name='sdir', | ||
) |
Binary file not shown.