-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
611 changed files
with
7,702 additions
and
2,372 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Invalidations | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- ready_for_review | ||
|
||
concurrency: | ||
# Skip intermediate builds: always. | ||
# Cancel intermediate builds: always. | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
evaluate: | ||
# Only run on PRs to the default branch. | ||
# In the PR trigger above branches can be specified only explicitly whereas this check should work for master, main, or any other default branch | ||
if: github.base_ref == github.event.repository.default_branch | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: '1' | ||
- uses: actions/checkout@v3 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-invalidations@v1 | ||
id: invs_pr | ||
|
||
|
||
- uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.repository.default_branch }} | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-invalidations@v1 | ||
id: invs_default | ||
|
||
|
||
- name: Report invalidation counts | ||
run: | | ||
echo "Invalidations on default branch: ${{ steps.invs_default.outputs.total }} (${{ steps.invs_default.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY | ||
echo "This branch: ${{ steps.invs_pr.outputs.total }} (${{ steps.invs_pr.outputs.deps }} via deps)" >> $GITHUB_STEP_SUMMARY | ||
- name: Check if the PR does increase number of invalidations | ||
if: steps.invs_pr.outputs.total > steps.invs_default.outputs.total | ||
run: exit 1 |
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,18 @@ | ||
name: Check for unused dependencies | ||
|
||
on: | ||
pull_request: | ||
types: | ||
- ready_for_review | ||
|
||
|
||
jobs: | ||
treeshake: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: 1 | ||
- uses: julia-actions/julia-buildpkg@v1 | ||
- uses: julia-actions/julia-treeshake@main |
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 |
---|---|---|
|
@@ -2,5 +2,6 @@ | |
ignore: | ||
- "./src/errors.jl" | ||
- "./src/_errors.jl" | ||
- "./src/__precompilation.jl" | ||
- "./test" | ||
- "./scripts" |
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,13 @@ | ||
# Annotations | ||
```@meta | ||
CurrentModule = Term.Annotations | ||
``` | ||
|
||
|
||
```@index | ||
Pages = ["api_annotations.md"] | ||
``` | ||
|
||
```@autodocs | ||
Modules = [Annotations] | ||
``` |
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,14 @@ | ||
# Prompts | ||
```@meta | ||
CurrentModule = Term.Prompts | ||
``` | ||
|
||
|
||
```@index | ||
Pages = ["api_prompt.md"] | ||
``` | ||
|
||
|
||
```@autodocs | ||
Modules = [Prompts] | ||
``` |
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,66 @@ | ||
# Prompt | ||
|
||
Time for a little example of a simple thing you can use `Term.jl` for: asking for some input. Use a `Prompt`, ask a question, get an answer. Simple, but a little extra style. That's what `AbstractPrompt` types are for. There's a few different flavors, which we'll look at in due time, but essentially a prompt is made of a bit of text, the `prompt` that is displayed to the user, and some machinery to capture the user's input and parse it/ validate it. | ||
|
||
For example: | ||
|
||
```@example prompt | ||
using Term.Prompts | ||
prompt = Prompt("Simple, right?"); | ||
``` | ||
|
||
creates a `Prompt` object and `ask` then prints the propmt and asks for input: | ||
```julia | ||
prompt |> ask | ||
``` | ||
the output should look something like | ||
```@example prompt | ||
print(prompt) # hide | ||
``` | ||
|
||
here we construct a basic `Prompt` and "ask" it: print the message and capture the reply. `ask` returns the answer, which you can do with as you please. A small warning before we carry on: | ||
|
||
!!! warning "Using VSCode" | ||
As you can see [here](https://discourse.julialang.org/t/vscode-errors-with-user-input-readline/75097/4?u=fedeclaudi), `readlines`, which `AbstractPrompts` use to get the user's input, is a bit troublesome in VSCode. In VSCode, after the prompt gets printed you need to enter "space" (hit the space bar) and then enter and **after** that you can enter your actual replies. | ||
|
||
## Prompt flavours | ||
There's a couple more ways you can use prompts like. One is to ensure you get an answer of the correct `Type`, using the immaginatively names `TypePrompt`: | ||
|
||
```@example prompt | ||
# this only accepts `Int`s | ||
prompt = TypePrompt(Int, "give me a number") # don't forget to |> ask | ||
print(prompt) # hide | ||
``` | ||
|
||
|
||
If your answer can't be converted to the correct type you'll get a `AnswerValidationError`, not good. | ||
|
||
|
||
So, what if you want to get user inputs, but you don't want to handle any crazy input they can provide? Fear not, use `OptionsPrompt` so that only acceptable options will be ok. This will keep "asking" your prompt until the user's answer matches one of the given options | ||
|
||
```@example prompt | ||
prompt = OptionsPrompt(["a lot", "so much", "the most"], "How likely would you be to recomend Term.jl to a friend or colleague?") # don't forget to |> ask | ||
print(prompt) # hide | ||
``` | ||
|
||
Okay, so much typing though. Let's be realistic, most likely you just want to ask a yes/no question and the answer is likely just yes. So just use a `DefaultPrompt`: | ||
|
||
```@example prompt | ||
# one says the first option is the default | ||
prompt = DefaultPrompt(["yes", "no"], 1, "Confirm?") # don't forget to |> ask | ||
print(prompt) # hide | ||
``` | ||
|
||
still too much typing? You can just use the `confirm` function which is equivalent to asking the prompt shown above. | ||
|
||
|
||
## Style | ||
The style of prompt elements (e.g. the color of the prompt's text or of the options) is defined in `Theme`. You can also pass style information during prompt creation: | ||
|
||
```@example prompt | ||
Prompt("Do you like this color?", "red") |> println | ||
DefaultPrompt(["yes", "no"], 1, "Confirm?", "green", "blue", "red") |> println | ||
``` |
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
Oops, something went wrong.