Comments (15)
Another option is busybox. It's not pure rust, but it does come as a library, and I know busybox is very mature and widely used, so it could be a good option.
from just.
I ended up doing this:
update-dc service="all":
#!/usr/bin/env node
let srv = "{{service}}"
let services = [
"anime",
"homebox",
"hass",
"tubesync",
"photoprism",
"tvheadend",
"jellyfin",
"jdownloader",
"notes"
]
console.log("==> Service: "+srv)
function update_one(s) {
console.log("Updating "+s+"...")
}
if(srv == "all") {
services.forEach(v => update_one(v))
} else if(services.indexOf(srv) >= 0) {
update_one(srv)
} else {
console.error("Unknown service: "+srv)
process.exit(1)
}
It's not fully implemented, as you can see, but it got me somewhat what I need. But it also is not very elegant... ^^'
from just.
The plan is to eventually have Python built into Just so that it has a multi-platform (Windows and everything else) scripting language. But until then using an external language is usually best. I'm on Mac but often need to support Windows so I installed PowerShell Core on my Mac and utilize whatever version of PowerShell is installed on the Windows system to avoid installing anything on target systems beyond the Just executable.
integrating a scripting-language sounds awesome, though I believe lua is the better choice for that, having worked on integrating both.
Is there already an issue about that with some design decisions?
Is it actually worth investing time, seeing other PRs don't get reviews? ( I fully understand lack of time on maintainer side, which is totally OK, I only want to prevent wasting time on something that won't get reviewed )
from just.
Personally I only care about the basics, as long it can accomplish the equivalent of Bourne shell with arrays or lists in a cross-platform way I'm all good. It would be wonderful if it was 100% Python 3.7+ compatible with no surprises but that's a minor benefit (to me) over just covering the shell basics. I've not investigated at all yet. Though I'm happy to investigate when a get some free time.
That or just bake in Nushell which is also Rust based and there is embed-nu - Crates.io. Anything to get cross platform basic shell scripting would be a godsend. 👼
from just.
I think that exploring what Python support would look like is probably reasonable. It might not be ready to stabilize, but it would be interesting to see how it works. I'm worried that it'll drive compile times and binary size through the roof, but we can make it an optional feature.
from just.
I second this. How can I iterate over a list of values? In my case, I want to bind values to parameters interpolated within commands.
from just.
Hello!
I would like to automate the management of my docker-compose environments for self-hosted services to some degree, and a Justfile seems like a very clean solution. However, I couldn't find out how to dynamically create tasks.
Consider an array of
["jellyfin", "tubesync", "tvheadend"]
. I would like to be able to generate apropriate tasks for-down
,-pull
, and-start
.Is this possible?
Thanks!
do task arguments suit your needs?
like having a parameter to target the service and another one targeting action
from just.
I second this. How can I iterate over a list of values? In my case, I want to bind values to parameters interpolated within commands.
there is an example on readme using bash for loop, have you tried this one?
from just.
The bash for loop doesn't seem applicable. Here's an example. Given a collection ["one", "two", "three"], how would we iterate over its elements, using each element within string interpolated commands executed by just?
from just.
Example:
recipe context +collection:
#!/bin/sh
if [ '{{collection}}' != '' ]; then
for item in {{collection}}; do
just dynamic-{{context}} $item
done
else
echo "No collection to process with dynamic-{{context}}"
fi
or something like that? That's how I tend to do it. Unless the recipe may end up on a Windows system in which case I usually use PowerShell instead of a POSIX compliant shell for both platforms.
from just.
The plan is to eventually have Python built into Just so that it has a multi-platform (Windows and everything else) scripting language. But until then using an external language is usually best. I'm on Mac but often need to support Windows so I installed PowerShell Core on my Mac and utilize whatever version of PowerShell is installed on the Windows system to avoid installing anything on target systems beyond the Just executable.
from just.
It's a good idea to check in with @casey first before jumping on anything that isn't OK just for your own edification. If you want to try anything Python is definitely the preferred language. See #537 for some discussion on the matter.
from just.
Hi, is there any updates? Iterating through a list is quite useful!
from just.
Hey @casey, they claim it's not production ready but RustPython is in use by Ruff the Python linter. Maybe good enough now for most recipe scripting?
from just.
I'd be a little cautious if it isn't production ready. We could land something as unstable, but if it was incompatible with python in unexpected ways, it might be frustrating.
from just.
Related Issues (20)
- Add a --list-paths to output list of recipe paths only HOT 4
- Submodules should be groupable (or have their own group) HOT 6
- Passing arguments for python different than node? I needed to add -- HOT 4
- Parser support for attributes with multiple arguments HOT 1
- Module improvement tracking issue HOT 2
- No .ps1 extension added when pwsh.exe is started via third-party tool HOT 6
- Possible to get autocompletions working in Warp?
- dotenv-path unexpectedly loads .env from parent directory HOT 1
- [Feature Request] `just global init-rust`; an ability to define global `Justfile` that will run commands anywhere on your machine. HOT 2
- Stabilize `[script(…)]` attribute HOT 6
- Comments Ending in Backslash also Comment following Command HOT 2
- Add ability to add new dependency without clobbering rule HOT 6
- Transitive options when using modules
- `just --list` should highlight parts of the comment surrounded by backticks (`) HOT 1
- Set default working dir for the whole justfile HOT 2
- Multiple optional parameters, specifying only one HOT 1
- Command line flag to exit without error if recipe not found HOT 1
- Add missing or (if it's there) improve module information in documentation HOT 1
- Mark recipes as exportable/non-exportable HOT 1
- Warning when compiling with Rust 1.80 HOT 1
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 just.