Git Product home page Git Product logo

Comments (5)

smeech avatar smeech commented on May 27, 2024 1

Apologies - I failed to copy the final "'" (single inverted comma) at the end of the last line. I've added it above and checked it works here.

from espanso.

moshpirit avatar moshpirit commented on May 27, 2024 1

Thanks! I think this should be added to the documentation, it's an amazing tool!

from espanso.

smeech avatar smeech commented on May 27, 2024

It's not too difficult. Here's a script I wrote in response to a user's query on Discord recently, which builds on the examples in the docs:

  - trigger: :atest
    replace: "{{output}}"
    vars:
      - name: form1
        type: form
        params:
          layout: "[[choices]]"
          fields:
            choices:
              type: choice
              values: |
                one
                two
                three
      - name: output
        type: shell
        params:
          cmd: echo $"{{form1.choices}}" | sed 's/one/four/;s/two/five/;s/three/six/'

By making the form a named variable, it takes its output and makes it available for a script to change the output for the replace:. If you want to try it, the last line may need altering to suit your OS and shell, but it illustrates the principle.

from espanso.

smeech avatar smeech commented on May 27, 2024

If this answers your question, I'll close the Issue. If I've misunderstood, please let me know!

from espanso.

moshpirit avatar moshpirit commented on May 27, 2024

Sorry, I couldn't check it until now.

I copied/pasted it in a new file called scripts.yml in the same folder, but got this error: [Espanso]: An error occurred during rendering, please examine the logs for more information. I tried it with the three options and still got the same result. I also added the force_mode: clipboard that we talked about in another issue.

EDIT: found the log!

12:06:34 [worker(56269)] [ERROR] shell command exited with code: exit status: 2 and error: bash: -c: línea 1: EOF inesperado mientras se buscaba un `'' coincidente

12:06:34 [worker(56269)] [WARN] extension 'shell' on var: 'output' reported an error: command reported error: '`bash: -c: línea 1: EOF inesperado mientras se buscaba un `'' coincidente
`'
12:06:34 [worker(56269)] [ERROR] error during rendering: rendering error

Caused by:
    command reported error: '`bash: -c: línea 1: EOF inesperado mientras se buscaba un `'' coincidente
    `'

English translation:

12:06:34 [worker(56269)] [ERROR] shell command exited with code: exit status: 2 and error: bash: -c: line 1: Unexpected EOF while searching for a matching ``''

12:06:34 [worker(56269)] [WARN] extension 'shell' on var: 'output' reported an error: command reported error: '`bash: -c: line 1: Unexpected EOF while searching for a `' ' coincident
''
12:06:34 [worker(56269)] [ERROR] error during rendering: rendering error

Caused by:
     command reported error: '`bash: -c: line 1: Unexpected EOF while searching for a matching `''
     ''

from espanso.

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.