Giter Club home page Giter Club logo

handles's People

Contributors

appellation avatar pgbiel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

pgbiel jimmwizzy

handles's Issues

Arguments in v3 & what "maybe" should be changed.

All complaints/enhancements to arguments that was changed in v3, which we've been discussing on Discord for some time now. ๐Ÿ˜„

Optional arguments

Creation of optional arguments has it's issues since providing the Prompt is redundant.

Example:

yield new Argument('My prompt', 'My rePrompt').setOptional() // Prompt not needed.

Since the Prompt is only given if there's a must for the argument there is no need to pass it. The only reason to pass it is to have the ability to set the rePrompt which might be needed in case the optional argument fails.

On top of that which is a minor detail: setOptional() is is defaulted to true but you have the ability to set it to false, I don't see why you would need to set it to false if your argument isn't optional? Simply don't use the method. (Unless you would like to disable the optional part on the fly without having to delete a line of code.)

Named arguments

More detail on issue: #4

Named arguments can provide cleaner code, let's say you have a roll command and you have the input of min and max.

let min = command.args[0]
let max = command.args[1]

Creating variables to use in our command makes it easier to find out what you're working with, also you won't have to repeat the whole command.args[index] over and over. This will especially repeat itself in more complex commands if needed.

Having the ability to track down your arguments the following way:

command.args.min
command.args.max

Would not only make it easier to repeat and cleaner to look at, it will also make error messages easier to work with if you do not decide to create variables for each argument.

Usage of command.body

The command.body gives the entire body of the command without the prefix & command name. This comes in handy if you're working with arguments that are in multiple words. For instance if you have a translation command and you wish to translate a sentence.

However, new Argument() treats every word as it's own argument. Creation of the argument is only needed to let the user know that there is indeed an argument needed. (Prompt/rePrompt) But you do not make use of the command.args when you write the actual execution of the command.

It seems that you jump a bit back and forth depending on when you're using a single worded argument & a multiple worded "argument". Could be moved together somehow.

Creation of argument suffix

Just a friendly reminder to remember that there should be an ability to set the argument suffix without having to instantiate the argument class and manually setting the suffix property BEFORE yielding it.

Named args

Consider making arguments named so they can use an object rather than an array.

Linting

Should probably use more comprehensive linting.

Global middleware

There should exist functionality for middleware to be run globally before all commands.

Arguments don't work with non-lowercase commands

The argument processor doesn't correctly interpret args provided to commands that are not cased correctly. This probably is because the command doesn't get trimmed off correctly when it's not lower case.

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.