Git Product home page Git Product logo

Comments (15)

alexkubica avatar alexkubica commented on May 23, 2024

Would you like to use something like getopt?

from mal.

ryukinix avatar ryukinix commented on May 23, 2024

I was thinking to use a more abstract library like argparse

from mal.

alexkubica avatar alexkubica commented on May 23, 2024

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.

ryukinix avatar ryukinix commented on May 23, 2024

Is just that! A good way to parse and we can add more features later without big problems.

from mal.

alexkubica avatar alexkubica commented on May 23, 2024

I see, I think I can do that!

from mal.

ryukinix avatar ryukinix commented on May 23, 2024

Thanks! I will be glad for any improve on this.

from mal.

alexkubica avatar alexkubica commented on May 23, 2024

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.

ryukinix avatar ryukinix commented on May 23, 2024

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.

alexkubica avatar alexkubica commented on May 23, 2024

I understand, i'll go by your suggestion.
Do you think each command should be a sub-command?

from mal.

ryukinix avatar ryukinix commented on May 23, 2024

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.

ryukinix avatar ryukinix commented on May 23, 2024

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.

alexkubica avatar alexkubica commented on May 23, 2024

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.

alexkubica avatar alexkubica commented on May 23, 2024

Never mind, it seems we don't need it any more, this works: https://github.com/AlexK-IL/mal/commit/762c8f708859c24433925bd7627214d60a283ae1.

from mal.

alexkubica avatar alexkubica commented on May 23, 2024

Since #12 was merged, I'm closing this issue.

from mal.

ryukinix avatar ryukinix commented on May 23, 2024

Good job!

from mal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.