-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for custom "wrappers" #43
Comments
Right now you can extend transports like this: Transport.prototype.getuid = function(args, opts) {
opts = this._parseOptions(opts);
return this.__exec('getuid', args, opts);
}; This is far from optimal, what would your solution look like? |
That's good enough I think, but the question is how is that (the prototype) best exposed? Some conventions would help: how do extensions access the transport prototype, where are they stored, etc. Considering only *nix for the sake of simplicity, maybe Flightplan could look at $FLIGHTPLAN_LIB/extensions and require() every file there, passing as args the Transport prototype... or some such. |
It's not a good idea to store user data into a folder controlled by npm, or introducing an obscure env variable. What if you would just extend your Flightplan class to fit your needs and then in var Flightplan = require('./lib/deployment/flightplan'); // extended class
var plan = new Flightplan();
//... |
I agree on not messing with npm controlled directories (hence the suggestion of an env variable). What you suggest is very similar to what I am doing right now, actually. But I was hoping for a solution that permits easy sharing of such extensions, which is really where the benefit lies... if I can find extensions/recipes from the Flightplan ecosystem, that would save me time (and vice versa with my extensions). BTW, marginally related to this, I also have a crude mechanism to "include" flightplans in others, by exporting the flight in module.exports. Not sure if you have any plans such a feature, and if you do, +1 on that from me :-). |
So you'd like to see some kind of tooling ecosystem like Do you have any input regarding splitting the codebase into smaller pieces or how you'd like to interact with the API for writing plugins? |
Sorry missed the above comment. I have not looked into the code much so unfortunately do not have any suggestions on what structural changes can be made. In terms of the API for writing plugins, even a somewhat clean way of exposing the prototype might do... the real usability issue, I feel, will be in how easy it is to share and deploy these plugins. |
Hey @ravi If you're still interested in this subject, please make a quick proposal in the form of code snippets how you'd like to write extensions and how to load them as a developer. Thanks |
Hi @pstadler
In the same way I want to extend argument passing so that the when those are given as an array automatic shell escaping occurs (through https://www.npmjs.com/package/shell-escape) which can make scripts smore readable:
This would be backwards compatible as it is only triggered if What do you think? |
Hi @akloeber
|
-> 1.
If source/target may contain additional special characters (like
In my opinion that could be handled nicely within flightplan (while also staying backwards compatible) and it would improve the overall readability/maintainability of the scripts. |
With apologies for not fully reading the comments above before I write the below: IMHO custom commands/wrappers should be auto-discovered by Flightplan, such as in the example above. Wrappers should be able to do complex operations not just run one single command. |
Per the documentation, there are convenience wrappers for common commands like
ls
. It would be very useful if this feature can be extended such that we can add custom wrappers, and even share them:I realise
stdout
in the above is a string, it contains a newline, etc, but I am ignoring that in the interest of keeping example simple. I hope you get what I am driving at.Since this is a somewhat significant and philosophical issue, I am asking first if this is an interesting direction for the project, rather than sending a PR.
The text was updated successfully, but these errors were encountered: