question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi,

Script shortcuts are great and very helpful in project. But they are too simple and stupid for now. There are some features which will be great to implement to my mind:

  1. Multi-line commands. For now there are no simple way to specify multiple commands, e.g.:
[scripts]
cmd = [
    "echo 1",
    "echo 2"
]

Of course as workaround I can use bash -c "echo 1 && echo 2", but if I want to write something complex with two more command it will be like a mess.

  1. Positional arguments in commands. Would be great to implement something like implemented in tox (http://tox.readthedocs.io/en/latest/config.html#substitutions-for-positional-arguments-in-commands). It’s very useful for example in case of tests:
[scripts]
test = py.test {posargs:tests/unit/}

And pyenv run test to run all tests or pyenv run test -- tests/unit/test_utils.py to run subset of tests.

This is just a proposal and I’m interesting in what you think about that.

Thanks!

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
techalchemycommented, May 9, 2018

@stevenhair that unfortunately isn’t how it works. We are happy to maintain it the way it is. We are not interested in building an entire new application to support endless use cases around it. The current tooling provides a helper suite to supplement pipenv run, but it’s a little odd to tell us we need to either build more features into it or remove it entirely, isn’t it?

6reactions
uranusjrcommented, Apr 24, 2018

Maybe we can introduce optional Invoke integration like this

# Pipfile

[scripts]
command = "echo This is a regular command"
task = { task = "mytask" }
test = { task = "mytask", defaultargs = "tests/unit" }
# tasks.py

import invoke

@invoke.task()
def mytask(ctx):
    print('This is an invoke task callable from Pipfile')

@invoke.task()
def test(ctx, mod):
    # mod receives
    #     "tests/unit" if run with "pipenv run test"
    #     <arg> if run with "pipenv run test <arg>"
    ctx.run(f'pytest {mod}')

Pipenv will not bundle Invoke, but simply converts the { task = "..." } construct into a invoke ... call, and show and error message if Invoke is not installed (either globally or in the virtualenv).

Thoughts @techalchemy?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getting started with scripting for Shortcuts | iMore
One of the most powerful sections at your disposal in the Shortcuts app is called Scripting. This menu lets you work with device...
Read more >
Shortcuts User Guide - Apple Support
A shortcut is a quick way to get one or more tasks done with your apps. The Shortcuts app lets you create your...
Read more >
How To Format A Script With Keyboard Shortcuts
Screenwriting Keyboard Shortcuts For Running Scripts · CTRL + S – Saves your script · CTRL + A – Selects everything · CTRL...
Read more >
Beginner's Guide to Siri Shortcuts - Part 4: Scripting - YouTube
Welcome to part four of my Beginner's Guide to Siri Shortcuts. In this fourth part we'll learn about how to use scripting actions...
Read more >
How to Allow Running Script in Shortcuts App on iPhone and ...
Do you need to run JavaScript on web page in Apple Shortcuts ? Here is how you can allow running script in Shortcuts...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found