Skip to content

Commit 6f43053

Browse files
authored
Little contribution from my side i also found rich package is also required to be downloaded (#23)
* chore: listed content of init files * fix: token.column is none cant perform " - " operation * style: test dir is removed
1 parent 6252cb8 commit 6f43053

File tree

3 files changed

+22
-27
lines changed

3 files changed

+22
-27
lines changed

goboscript-docs/src/installation.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
- [Automatic Installation](#automatic-installation)
2-
- [Manual Installation](#manual-installation)
1+
- [Automatic Installation](#automatic-installation)
2+
- [Manual Installation](#manual-installation)
33

44
# Automatic Installation
55

@@ -37,7 +37,6 @@ If everything goes well, goboscript will be installed.
3737
Verify that goboscript is installed and is working.
3838

3939
```sh
40-
cd test/
4140
gsc
4241
```
4342

@@ -46,10 +45,11 @@ gsc
4645
If the automatic install fails, continue with these instructions.
4746

4847
goboscript depends on the following dependencies:
49-
- [Python](https://www.python.org/)
50-
- [pip](https://pip.pypa.io/en/stable/)
51-
- [setuptools](https://setuptools.pypa.io/en/latest/)
52-
- [Lark parser](https://github.com/lark-parser/lark/)
48+
49+
- [Python](https://www.python.org/)
50+
- [pip](https://pip.pypa.io/en/stable/)
51+
- [setuptools](https://setuptools.pypa.io/en/latest/)
52+
- [Lark parser](https://github.com/lark-parser/lark/)
5353

5454
Try to install these dependencies using your operating system's built-in package
5555
manager. If any python module is not available, try to install it using pip.

goboscript/__main__.py

+7-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
epilog="documentation: https://aspizu.github.io/goboscript-docs",
1313
)
1414

15-
1615
def input_t(argument: str) -> Path:
1716
path = Path(argument)
1817
if not path.is_dir():
@@ -23,14 +22,12 @@ def input_t(argument: str) -> Path:
2322
)
2423
return path
2524

26-
2725
def output_t(argument: str) -> Path:
2826
path = Path(argument)
2927
if path.is_dir():
3028
raise argparse.ArgumentTypeError(f"{path} is a directory.")
3129
return path
3230

33-
3431
argparser.add_argument(
3532
"--init",
3633
action="store_true",
@@ -56,23 +53,22 @@ def output_t(argument: str) -> Path:
5653
watch = args.watch
5754
if init_cmd:
5855
path = Path().absolute()
56+
file_data = [
57+
(path / f"stage.{EXT}", 'costumes "blank.svg";\n'),
58+
(path / f"main.{EXT}", 'costumes "blank.svg";\n\nonflag {\n say "Hello, World!";\n}\n'),
59+
(path / "blank.svg", '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg><!--rotationCenter:0:0-->'),
60+
]
5961
if (path / f"stage.{EXT}").is_file():
6062
argparser.error("Working directory already contains a goboscript project.")
61-
(path / f"stage.{EXT}").open("w").write('costumes "blank.svg";\n')
62-
(path / f"main.{EXT}").open("w").write(
63-
'costumes "blank.svg";\n\n' + "onflag {\n" ' say "Hello, World!";\n' "}\n"
64-
)
65-
(path / "blank.svg").open("w").write(
66-
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"></svg><!--rotationCenter:0:0-->'
67-
)
63+
([file_path.open("w").write(content) for file_path, content in file_data])
6864
sys.exit()
6965
input: Path | None = args.input
7066
if input is None:
7167
input = Path()
7268
if not (input / f"stage.{EXT}").is_file():
7369
argparser.error(
7470
"Working directory is not a goboscript project, "
75-
"please provide an --input argument."
71+
"Please provide proper directory using --input argument."
7672
)
7773
output: Path | None = args.output
7874
if output is None:
@@ -81,8 +77,6 @@ def output_t(argument: str) -> Path:
8177
argparser.error(
8278
f"{output} is a directory, please provide a different --output argument."
8379
)
84-
85-
8680
try:
8781
build_gproject(input).package(output)
8882
except Error as e:

goboscript/paste.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,16 @@ def include(
9898
for ifile in self.relative.glob(path):
9999
self.include(ifile, file, range)
100100
else:
101-
ifile = self.relative / path
102-
if not ifile.is_file():
103-
raise RangeError(
104-
error.Range(file_i, token.column - 1, len(token)),
105-
"File not found",
106-
file=file,
101+
if token.column is not None:
102+
ifile = self.relative / path
103+
if not ifile.is_file():
104+
raise RangeError(
105+
error.Range(file_i, token.column - 1, len(token)),
106+
"File not found",
107+
file=file,
107108
)
108109

109-
self.include(ifile, file, range)
110+
self.include(ifile, file, range)
110111
file_start = file_i + 1
111112
case _:
112113
raise ValueError(tree)

0 commit comments

Comments
 (0)