How to customize a parser for options in spring shell? - spring

I'm using Spring shell to develop command shell for my project.
the problem is as i described below:
i need to have some functionality like method overloading in shell. in other words i need to have two commands with same name but different options.
I googled it and found some ideas like overriding parser interface, but i did not find any samples over internet.
any suggestions will be helpful.
Thank for your help.

You need to implement org.springframework.shell.core.Converter and add #Component to it.

Related

create custom slash command in slack using #botname instead of /botname

I tried to create a slack application using the link, its working as /botname str.
is there any way that we could invoke application in slack using #botname str instead of /botname str. tried searching various places, couldn't get on how to do, can anyone help on it.
To use #botname instead of \botname, you'll need to change approach of implementation.
You need to implement by subscribing to 'Slack Events'.
This should help you to start:
https://api.slack.com/apis/connections/events-api
https://api.slack.com/events/app_mention

How to override entity pluralisation?

I've started playing around with API Platform and it's looking like a fantastic but of kit and generally a quick Google or Stack Overflow search answers and questions I might have.
However, this one I'm struggling with and it could be a simple terminology issue...
How do I go about changing or overriding the automatic pluralisation of entity names? I.e. Fleet is becoming Fleets.
Any tips on where to look for documentation or any quick examples of how to do what I'm after? I'm using annotations.
Thanks in advance!
You can create custom Operation Path Resolver which doesn't use Inflector::pluralize().
There is section in docs about it (https://api-platform.com/docs/core/operation-path-naming/#create-a-custom-operation-path-resolver).
It requires creating custom class which implements OperationPathResolverInterface (https://github.com/api-platform/core/blob/master/src/PathResolver/OperationPathResolverInterface.php)

JavaScript rule extension

I am trying to extend Sonarqube with custom Javascript rules. I find that the documentation is fairly limited on this subject. The extension tutorials on sonarqube website show only the most basic stuff.
The only javadoc I could find is this one: http://javadocs.sonarsource.org/latest/apidocs/ and it doesn't cover anything about extending Javascript.
What I ultimately want to do is add a JS rule that will check for hardcoded secrets (such as passwords, api keys, etc). I already created one for Java, and that was a lot easier as I could take an already pre-made plugin and complete it with my custom regex.
The problematic spot that made me post here was actually this one:
cannot find symbol
symbol: class VariableTree
location: package org.sonar.plugins.javascript.api.tree.expression
I was following the same scheme as with Java and used
import org.sonar.plugins.javascript.api.tree.expression.VariableTree;
which is obviously wrong. I was not able to find the source code for this either... if anybody can point me to some secret doc stash or at least where I can find a javadoc for org.sonar.plugins.javascript.api that would be amazing!
Thanks very much for any help

What to use for embedded arrays?

Is there support for embedded arrays in form? Like list of emails or phone numbers (these entities do not exist as standalone resource so it is impossible to use Reference* fields/inputs). SelectArrayInput looks promising, but it needs to know in advance possible options which is not the case (maybe there is an easy way to modify it to accept any option after hiting an enter button?).
Not currently, you'll have to make a custom input. If you do, please make it an addon and we'll reference it in the documentation.
Also note that someone started an addon about this: https://github.com/marmelab/admin-on-rest/pull/697

How to create a javascript mongodb-tutorial-like browser shell

MongoDB website uses a "Browser Shell" to let anybody try how it works really easily. I would like to implement something like that for a site to let devs do some HTTP request for a REST API - how should I approach this? Is there a plugin or tool that I could use?
The mongoDB example can be found here: http://www.mongodb.org/# - click "Try It Out".
The "mongulator" code, written by Kyle Banker, is what you want. He talks about it here:
http://kylebanker.com/blog/2010/1/try-mongodb-browser/
You can see the code on github here:
https://github.com/banker/mongulator
There are also other similar non-MongoDB options available out there as examples - good hunting!
Spring Shell might be helpful
http://www.springsource.org/spring-shell
You can visit www.domongodb.com. I am sure you want like this an online mongodb shell to try actual mongodb commands. http://www.domongodb.com
The latest version of the interactive web shell on try.mongodb.org was discussed on the MongoDB Blog with code available on Github.
Note that interactive shells in a web environment have some peculiar limitations (some of which are covered on the blog post) esp. surrounding activity which can block the browser thread.

Resources