I am using TeamForge's CLI to create artifacts in the Defects tracker section. The CLI file/executable is called "ctf" with no extensions. I want to use a python script to create artifacts but can only execute one command at most. I want to create a bug in one shot. This is the code I have so far:
import os
os.system("./ctf go tracker1234; # going to Defects section
create; # creating an artifact
set title This Is A Title; # setting artifact's fields
set description desc123;
set Product [Product 23];
set build_number Not known;
set Severity Catastrophic;
set steps_to_reproduce 1st comment;
set Component [component 4];
set Version [version 19];
commit) # saving the artifact on TeamForge
Here is the error I keep getting:
sh: 1: create: not found
sh: 1: commit: not found
So I believe that these commands are not being executed sequentially or in the order that I have specified. This means that each command is being executed separately. Any suggestions to get these commands running in the order that I have specified?
Let me know if further explanation is required.
Update
I just found out that you can do this: go tracker1234 create
which is two steps in one
You could try to quote your arguments to ctf; just look at this:
>>> os.system("echo hi; echo again;")
hi
again
versus:
>>> os.system("echo 'hi; echo again;'")
hi; echo again;
The semicolon terminates a command in a shell. If your arguments contain semicolons, you must quote them so they don't break your list of arguments.
However, according to the CTF guidelines, their way of handling such a situation with multiple commands seems to be putting them into a script and executing that with:
./ctf script.txt