-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: introduce rhai for preprocessing
- Loading branch information
Showing
7 changed files
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
version: Compose specification | ||
|
||
service: | ||
{{project-name}}: | ||
{{project-name | replace: '-', '_'}}: | ||
build: . | ||
|
||
networks: | ||
{{project-name}}-net: | ||
name: {{project-name}}-net | ||
{{project-name | replace: '-', '_'}}-net: | ||
name: {{project-name | replace: '-', '_'}}-net | ||
ipam: | ||
config: | ||
- subnet: 172.16.238.0/24 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// get the project name | ||
let project_name = variable::get("project-name"); | ||
|
||
// remove leading and trailing whitespace | ||
project_name = project_name.trim(); | ||
|
||
// replace spaces with dashes | ||
project_name = project_name.replace(" ", "-"); | ||
project_name = project_name.replace("_", "-"); | ||
|
||
// remove leading and trailing dashes and underscores | ||
while project_name.starts_with("-") || project_name.starts_with("_") { | ||
project_name = project_name.sub(1, project_name.len()); | ||
} | ||
while project_name.ends_with("-") || project_name.ends_with("_") { | ||
project_name = project_name.sub(0, project_name.len() - 1); | ||
} | ||
|
||
// check if the project name is empty | ||
if project_name.len() == 0 { | ||
print("Error: Project name cannot be empty or consist solely of invalid characters."); | ||
throw "Invalid project name"; | ||
} | ||
|
||
// set the project name | ||
variable::set("project-name", project_name); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.