Comments (15)
Would you like to use something like getopt?
from mal.
I was thinking to use a more abstract library like argparse
from mal.
Looks kinda the same to me :)
So for this issue you just wan't to use a library to parse arguments, right?
No extra features that I'm missing here?
from mal.
Is just that! A good way to parse and we can add more features later without big problems.
from mal.
I see, I think I can do that!
from mal.
Thanks! I will be glad for any improve on this.
from mal.
I'm walking through the documentation of argparse and I think the arguments should be changed to make implementation easier.
I was thinking about something like:
--inc -i N anime-by-regex
--dec -d N anime-by-regex
--section -s [watching | plan to watch | ... | rewatching]
--list-all -a
--find -f anime-by-regex
--help -h
The first argument received will be parsed and others will be ignored, for example if I would enter:
mal -a -h
This would just list all animes without printing help message.
Also, I noticed that mal
currently works on anime category only, how about adding an argument to choose the category which will default to anime right now? And in the future we could implement a manga option.
from mal.
Here we have a problem. I don't wants use the GNU standard for main commands, like search
, inc
, dec
, config
, login
and so on. Tools like https://github.com/beetbox/beets has a more simple usage, like http://platformio.org/ too. (tools written in python!)
Here is the help of beet
❯ beet
Usage:
beet COMMAND [ARGS...]
beet help COMMAND
Options:
--format-item=FORMAT_ITEM
print with custom format
--format-album=FORMAT_ALBUM
print with custom format
-l LIBRARY, --library=LIBRARY
library database file to use
-d DIRECTORY, --directory=DIRECTORY
destination music directory
-v, --verbose log more details (use twice for even more)
-c CONFIG, --config=CONFIG
path to configuration file
-h, --help show this help message and exit
Commands:
config show or edit the user configuration
convert convert to external location
duplicates (dup) List duplicate tracks or albums.
export export data from beets
fields show fields available for queries and format strings
help (?) give detailed help on a specific sub-command
import (imp, im) import new music
info show file metadata
list (ls) query the library
modify (mod) change metadata fields
move (mv) move or copy items
play send music to a player as a playlist
remove (rm) remove matching items from the library
stats show statistics about the library or a query
update (upd, up) update the library
version output version information
write write tag information to files
❯ platformio
Usage: platformio [OPTIONS] COMMAND [ARGS]...
Options:
--version Show the version and exit.
-f, --force Force to accept any confirmation prompts.
-c, --caller TEXT Caller ID (service).
-h, --help Show this message and exit.
Commands:
boards Pre-configured Embedded Boards
ci Continuous Integration
init Initialize new PlatformIO based project
lib Library Manager
platforms Platforms and Packages Manager
run Process project environments
serialports List or Monitor Serial ports
settings Manage PlatformIO settings
update Update installed Platforms, Packages and Libraries
upgrade Upgrade PlatformIO to the latest version
BTW, I wanna the CLI more minimal as possible. Tools with a lot of arguments is pretty mess. I have a sugestion for this arch:
mal search <anime-regex>
mal inc <anime-regex>
mal dec <anime-regex>
mal login
mal config
mal section <section-name>
mal download¹ <anime-regex>
mal watch² <anime-regex>
¹ and ² has a decription here #3 #4
We need thinking about the final result more rather the difficult of implementation. If we need use GNU standard for arguments, I prefer continues parsing manually the arguments with the current usage. If argparse makes the implementation of this parsing more hard we have two options: 1. search for another library; 2. create a minimal abstraction for add arguments that way.
About add the category options I'm ok with that, on the start I see some people talking about the lack of support for mangs. But I need to be clear: I really wants avoid GNU standard for arguments.
from mal.
I understand, i'll go by your suggestion.
Do you think each command should be a sub-command?
from mal.
I think is pretty like sub-commands. Another idea is using argparse like git parse: http://chase-seibert.github.io/blog/2014/03/21/python-multilevel-argparse.html
from mal.
Thanks for understand it, and again, thanks for the help. Will really cool if we can do that. Another tasks like #3 and #4 will more easily to add too.
from mal.
I've started working on the sub commands on this branch.
I'm having a difficult time refactoring the function isomorphic_increment on cli.py.
How can it be made simpler that it will get the anime regex and +1 or -1 instead of getting the args?
from mal.
Never mind, it seems we don't need it any more, this works: https://github.com/AlexK-IL/mal/commit/762c8f708859c24433925bd7627214d60a283ae1.
from mal.
Since #12 was merged, I'm closing this issue.
from mal.
Good job!
from mal.
Related Issues (20)
- MAL API it's broken: HTTP 404 HOT 29
- Refactor travis in favour of github actions
- Log in loop due to Attribute Error. HOT 2
- User cannot login if password contains unescaped special characters HOT 1
- Add torrent sub-command HOT 21
- Partial [Start/End] dates cannot be parsed and crash application HOT 5
- Option to disable "back and forth" animation on Windows HOT 8
- Create manpage and distribute with the software HOT 4
- Handle errors better if MyAnimeList API is not accessible HOT 21
- Shouldn't ask for score if score is already given when completing an anime HOT 6
- [solved] Unable to search usernames that start with dash HOT 6
- Store login credentials in encrypted form HOT 15
- [feature request] add 'comments' field to 'edit' function HOT 10
- Document api.py
- [need-update] `anime_regex` is a wrong arg name for search command HOT 3
- [bug] recent change broke search function HOT 5
- Update sphinx docs at /docs before official 0.4.0 release HOT 1
- Abandon appdirs and use ~/.config/mal HOT 10
- [Feature Request] List related anime in extended info HOT 2
- New logo for MAL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mal.