-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Feat: add ability to use example files (#12)
* ✨ add ability to use example files * 🐛 Reverse use_example flag to input kind resolution to be correct * ♻️ Use shorter flag name Co-authored-by: Robert Attard <[email protected]> * ♻️ Use shorter flag name * 🚧 add example flag to the new command TODO: configure flag in `gladvent.gleam` * 📝 change string description of example flag * ♻️ use example flag for new command correctly * ♻️ use list spread instead of iterator append when preparing task list for new command * 🐛 Remove example creation step from default new command sequence * ♻️ move run/example flag to command level instead of group level * ♻️ move remaining inputfile-related functions to the input module * 🐛 Fix helper text of run --example flag Co-authored-by: Robert Attard <[email protected]> --------- Co-authored-by: Robert Attard <[email protected]>
- Loading branch information
Showing
4 changed files
with
78 additions
and
24 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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import filepath | ||
import gladvent/internal/cmd | ||
import gleam/int | ||
|
||
pub type Kind { | ||
Example | ||
Puzzle | ||
} | ||
|
||
pub fn get_file_path(year: Int, day: Int, input_kind: Kind) -> String { | ||
filepath.join(dir(year), int.to_string(day)) | ||
<> case input_kind { | ||
Example -> ".example.txt" | ||
Puzzle -> ".txt" | ||
} | ||
} | ||
|
||
pub fn root() { | ||
filepath.join(cmd.root(), "input") | ||
} | ||
|
||
pub fn dir(year) { | ||
filepath.join(root(), int.to_string(year)) | ||
} |