Skip to content

Commit

Permalink
cli/_state: fix writing command to file
Browse files Browse the repository at this point in the history
  • Loading branch information
Arun Persaud committed Oct 19, 2024
1 parent 48106cb commit 564ac84
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/pymcnp/cli/_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,7 @@ def __init__(self):
self.path.parent.mkdir(exist_ok=True, parents=True)

if not self.path.is_file():
self.path.write_text(
"command = 'mcnp'\n"
'\n'
'def prehook():\n'
' return\n'
'\n'
'def posthook():\n'
' return\n'
)
self._sync_down()

def prehook(self):
pass
Expand Down Expand Up @@ -131,7 +123,7 @@ def _sync_down(self):
posthook = 'def posthook():\n' + ''.join(inspect.getsourcelines(self.posthook)[0][1:])

self.path.write_text(
f'command = {self.command}\n' + '\n' + prehook + '\n' + posthook + '\n'
f"command = '{self.command}'\n" + '\n' + prehook + '\n' + posthook + '\n'
)


Expand Down

0 comments on commit 564ac84

Please sign in to comment.