Comments (3)
Hello,
Thanks, for your answer. Yes, I have succeeded to make something works. I would like to have something, to run local application. (I think, this features, should be a basics for the desktop version).
But for powershell command, the call was not done in the correct format. The script was called like this :
PowerShell -File your-command-script.ps1 --shortcut=github_shortcut
But should be called with this format :
PowerShell -File your-command-script.ps1 -shortcut github_shortcut
It's works me with a workaround by using the args[0] and then replace the params name (.replace('--shortcut=', '') .
regards.
from platform.
Hey @manudss!
Thanks for your question.
I'm not an expert in PowerShell or Windows but I'll do my best to help you out.
Today, Action doesn't allow you to execute any custom code. We may support something like this in the future but at the moment you can use "add-param" as the main action for your options:
{
"view": {
"type": "list",
"options": [
{
"title": "Open Github Shortcut",
"action": {
"type": "add-param",
"name": "shortcut",
"value": "github_shortcut"
}
}
...
]
}
}
So when the user selects an option, your command (script) will be run with the shortcut
parameter. The value of this parameter will match the value of the corresponding option. For example, if the user selected "Open Github Shortcut", Slapdash would run your script in the following way:
PowerShell -File your-command-script.ps1 --shortcut=github_shortcut
Now, in your script, you'd need to check whether the command was run with the shortcut
parameter. If it was then you would need to match the parameter's value to the actual shortcut and run the respective command. Otherwise, your command should return a List View with options.
Alternatively, instead of using the shortcut's name as a parameter's value, you can use the file path instead. This may make things simpler for your script.
In our docs, there is a tutorial for the Copy Special Character command which demonstrates how a custom parameter is used to run a command.
I hope it's helpful but please let me know if I misunderstood how your command should work or if you have any questions.
from platform.
Glad you found the workaround.
We opt in to using the same style for passing arguments across all scripts. But it's understandable that in some scripts this will require additional parsing and conversion.
I think in the future we'll have some wrappers and helper functions to reduce the boilerplate code a developer has to write. For instance, we can build functions to parse arguments for each scripting language that we support.
I noted your feedback. Thank you!
from platform.
Related Issues (10)
- Security interrogation about remote scripts execution HOT 6
- Unable to make Alt+Space shortcut HOT 4
- Feature request: more flexibility on script extensions HOT 4
- A more full-fledged developer portal HOT 1
- [Question] How to make the command be called every time you type something. HOT 2
- Default value in text field not displayed HOT 5
- Search Text should reset after a moveAction
- Execute a command only when an option is selected HOT 2
- Changelog just died on the website
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from platform.