Skip to content

Commit 3a1cdad

Browse files
authored
Merge pull request #27 from CodePurble/config-file-arg
Add argument for path to pico_configs file
2 parents 034dc41 + 3abd3c8 commit 3a1cdad

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ It will also add example code for any features and optionally for some standard
1111
Running `./pico_project --help` will give a list of the available command line parameters
1212

1313
```
14-
usage: pico_project.py [-h] [-o OUTPUT] [-x] [-l] [-c] [-f FEATURE] [-over] [-b] [-g] [-p PROJECT] [-r] [-uart] [-usb] [name]
14+
usage: pico_project.py [-h] [-t TSV] [-o OUTPUT] [-x] [-l] [-c] [-f FEATURE] [-over] [-b] [-g] [-p PROJECT] [-r] [-uart] [-usb] [name]
1515
1616
Pico Project generator
1717
@@ -20,6 +20,7 @@ positional arguments:
2020
2121
optional arguments:
2222
-h, --help show this help message and exit
23+
-t TSV, --tsv TSV Select an alternative pico_configs.tsv file
2324
-o OUTPUT, --output OUTPUT
2425
Set an alternative CMakeList.txt filename
2526
-x, --examples Add example code for the Pico standard library

pico_project.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,7 @@ def CheckSDKPath(gui):
799799
def ParseCommandLine():
800800
parser = argparse.ArgumentParser(description='Pico Project generator')
801801
parser.add_argument("name", nargs="?", help="Name of the project")
802+
parser.add_argument("-t", "--tsv", help="Select an alternative pico_configs.tsv file", default="pico_configs.tsv")
802803
parser.add_argument("-o", "--output", help="Set an alternative CMakeList.txt filename", default="CMakeLists.txt")
803804
parser.add_argument("-x", "--examples", action='store_true', help="Add example code for the Pico standard library")
804805
parser.add_argument("-l", "--list", action='store_true', help="List available features")
@@ -1101,7 +1102,7 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger):
11011102

11021103
def LoadConfigurations():
11031104
try:
1104-
with open("pico_configs.tsv") as tsvfile:
1105+
with open(args.tsv) as tsvfile:
11051106
reader = csv.DictReader(tsvfile, dialect='excel-tab')
11061107
for row in reader:
11071108
configuration_dictionary.append(row)

0 commit comments

Comments
 (0)