0

I am trying to use invoke to set up a basic git routine. The problem I am running into is that I cannot seem to get invoke to take a string as an argument parameter. I get an error everytime I run the code. I am sure I am missing something simple. I am running using ZSH.

Any help would be greatly appreciated!

(stats) bnice5000@Macbook COVID-STATS % invoke push --message='fixed invoke'  
fatal: paths 'invoke ...' with -a does not make sense
(stats) bnice5000@Macbook COVID-STATS % 
from invoke import task
import datetime

foldername = '{:%Y%m%d}'.format(datetime.date.today())
commit_message = '\"Daily push for {0}\"'.format(foldername)

@task
def push(c, tag=False, message=''):
    c.run('git add --all')
    if not message:
        message = commit_message
    c.run('git commit -am {0}'.format(message))
    if tag:
        c.run('git tag {0}'.format(foldername))

    c.run('git push origin master')

Selcuk
  • 57,004
  • 12
  • 102
  • 110
BigHandsome
  • 4,843
  • 5
  • 23
  • 30
  • Can you run that command directly in a python interpreter and post the full trace back? – Paul H Jun 08 '20 at 04:48
  • do you have problem with `invoke push --help` or `invoke --list`? Maybe problem is not `invoke` but `git` command which you use. – furas Jun 08 '20 at 04:55
  • 1
    use `print()` instead of `c.run()` to see what command you have. You may have to add `" "` in `git commit -am "{0}"` because you have message with space. OR you have to use `" "` inside `' '` in `--message='"fixed invoke"'` – furas Jun 08 '20 at 05:00
  • @furas This is correct, post as the answer and I will give you credit. – BigHandsome Jun 08 '20 at 05:05

1 Answers1

2

First: you can use print() instead of c.run() to see what command you run.

You have to add " " in git commit -am "{0}" because you have message with space.

Or you have to use " " inside ' ' in --message='"fixed invoke"'

furas
  • 134,197
  • 12
  • 106
  • 148