[r46]: / trunk / cforge / cforge / Package / CFORGE / Scripts / checkout.py  Maximize  Restore  History

Download this file

36 lines (27 with data), 1.1 kB

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import sys, os
import cds_script
import ui


# This is a cforge command (script file)
# this will be run as ironpython script.
# the filename of this script is automatically the corresponding cforge command 
# with some magic functions you can easily integrate it nicely into cforge tool

# cforge_usage: 
# here you can return an array of all possible arguments and options that can 
# be passed to this command script
def cforge_usage():
    help = [ 
	    ["<path to CODESYS project>", "---"]
    ]

    return help

if len(sys.argv) <= 1:
    print("Oh, there are no arguments. Perhaps you forgot something?")
    sys.exit()

args = sys.argv[1].split(" ")
if len(args) == 1:
	folder = args[0].strip("/").split("/")[-1]
	config = ui.Dialog("Checkout", Folder=True, Credentials=True, DefaultFolder=folder)

if config != None:
	scriptpath = os.path.abspath(os.path.dirname(sys.argv[0]))
	scriptname = os.path.join(scriptpath, "action.svn.checkout.py")
	scriptargs = "%s %s %s %s" % (args[0], config["user"], config["pass"], config["folder"])

	cds_script.RunCodesysWithScript(scriptname, scriptargs, False)