Giter Club home page Giter Club logo

Comments (15)

casey avatar casey commented on July 30, 2024 2

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.

IngwiePhoenix avatar IngwiePhoenix commented on July 30, 2024 1

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.

syphar avatar syphar commented on July 30, 2024 1

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.

runeimp avatar runeimp commented on July 30, 2024 1

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.

casey avatar casey commented on July 30, 2024 1

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.

Dowwie avatar Dowwie commented on July 30, 2024

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.

cce-dsantos avatar cce-dsantos commented on July 30, 2024

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.

cce-dsantos avatar cce-dsantos commented on July 30, 2024

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.

Dowwie avatar Dowwie commented on July 30, 2024

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.

runeimp avatar runeimp commented on July 30, 2024

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.

runeimp avatar runeimp commented on July 30, 2024

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.

runeimp avatar runeimp commented on July 30, 2024

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.

fzyzcjy avatar fzyzcjy commented on July 30, 2024

Hi, is there any updates? Iterating through a list is quite useful!

from just.

runeimp avatar runeimp commented on July 30, 2024

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.

casey avatar casey commented on July 30, 2024

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)

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.