Coder Social home page Coder Social logo

user-scripts's People

Contributors

joshuawprice avatar

Watchers

 avatar

user-scripts's Issues

Allow use of environment variables for uploader arguments

Add support for reading environment variables for uploaders with optional arguments. This will let users add api keys to environment variable for more options for them.

I think for implementing this having the environment variable be dynamically based on the name of the uploader makes sense, with a pre/postfix that's intentionally unlikely to conflict but is guessable.

Link output issue with upload script

When files passed as arguments are prefixed with "./" it also adds that to the final link for the asgard uploader, making the output url incorrect. Affects both the bash and python script.

Automatically add uploaders

Uploaders in the file should automatically be added to the parser. This will make it so adding future uploaders only requires adding a new class that inherits from the uploader base class.

My first thoughts on how to do this make me think I should check the current file/"module" and add all of the classes that are a subclass of uploader. This will also require the classes to store more information, such as the action, help, nargs, metavar and more.

Files can be uploaded twice

If absolute and relative paths are used for the same file in the arguments, then the current deduplication code doesn't work and the file gets uploaded twice.

Add notifications

Add support for notifications to be sent upon command completion. Intended to be used in scripts once the item has finished uploading. The parser argument has already been added and now just needs implementing.

Improve parser consuming

At the moment the parser leaves a lot to be desired with regards to consuming arguments, a few examples of which are:

  • Arguments that have optional values such as asgard and catgirls will almost always consume the next argument if there is one, this should be changed to not consume it if it is a file (either by checking if file exists or at least if it begins with ./.), and stop consuming on -- like it does already.
  • If argument ends in / assume it is not a file and consume. This is for setting locations for uploaders like asgard, but depends on future design decisions as to whether or not I implement it.

As for implementing this I believe some of the nargs parameters will need to be removed from the add_arguments calls and the current actions to be modified. This idea came from this note in the argparse documentation:

If the nargs keyword argument is not provided, the number of arguments consumed is determined by the action. Generally this means a single command-line argument will be consumed and a single item (not a list) will be produced.

The above way is much better than the original way I thought, but I shall paste some bullet points below of my original notes in case the above fails:

  • Use append/extend action on files argument
  • Also have to make sure the argument to the uploader is not completely consumed, therefore would have to remove the automatic type conversions for the uploaders
  • Then append/create files attr
    I also thought of removing the nargs option from the files add_argument call and saving all the files to a separate location if possible.
  • Maybe - If argument ends in / then assume it is not a file and consume

I also think SingleAppendAction's name should be changed to something like UniqueAppendAction or UploadAction.
And lastly I think I should improve the init method in SingleAppendConstAction by using **kwargs (see argparse documentation action and Action classes

Add metavar to uploaders

Add the metavar attribute argument to asgard and catgirls uploaders. This is to make the help output more understandable.

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.