-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmenu.jl
More file actions
71 lines (65 loc) · 1.71 KB
/
menu.jl
File metadata and controls
71 lines (65 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using Pkg
Pkg.activate(@__DIR__)
using GLMakie
using CairoMakie
using VortexStepMethod
using REPL.TerminalMenus
url = "https://opensourceawe.github.io/VortexStepMethod.jl/dev"
example_files = [
"V3_kite.jl",
"billowing.jl",
"pyramid_model.jl",
"rectangular_wing.jl",
"ram_air_kite.jl",
"stall_model.jl",
"bench.jl",
"cleanup.jl",
]
function run_all()
failed_examples = String[]
for f in example_files
f == "cleanup.jl" && continue
println("\n" * "="^60)
println("Running: $f")
println("="^60)
try
include(joinpath(@__DIR__, f))
catch e
@error "Failed: $f" exception=(e, catch_backtrace())
push!(failed_examples, f)
end
end
if isempty(failed_examples)
println("\nAll examples completed.")
else
failed_list = join(failed_examples, ", ")
throw(ErrorException("run_all failed for $(length(failed_examples)) example(s): $failed_list"))
end
end
function example_menu()
options = [
[("$( splitext(f)[1]) = include(\"$f\")") for f in example_files];
"GLMakie.activate!()";
"CairoMakie.activate!()";
"help_me = VortexStepMethod.help(\"$url\")";
"quit"
]
active = true
while active
menu = RadioMenu(options, pagesize=11)
choice = request(
"\nChoose function to execute or `q` to quit: ",
menu)
if choice != -1 && choice != length(options)
eval(Meta.parse(options[choice]))
else
println("Left menu. Press <ctrl><d> to quit Julia!")
active = false
end
end
end
if "--run-all" in ARGS
run_all()
else
example_menu()
end