Skip to content

Commit ed80331

Browse files
committed
Added menu()
1 parent 5661518 commit ed80331

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

examples/menu.jl

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
using REPL.TerminalMenus
2+
3+
options = ["rectangular_wing = include(\"rectangular_wing.jl\")",
4+
"ram_air_kite = include(\"ram_air_kite.jl\")",
5+
"stall_model = include(\"stall_model.jl\")",
6+
"quit"]
7+
8+
function example_menu()
9+
active = true
10+
while active
11+
menu = RadioMenu(options, pagesize=8)
12+
choice = request("\nChoose function to execute or `q` to quit: ", menu)
13+
14+
if choice != -1 && choice != length(options)
15+
eval(Meta.parse(options[choice]))
16+
else
17+
println("Left menu. Press <ctrl><d> to quit Julia!")
18+
active = false
19+
end
20+
end
21+
end
22+
23+
example_menu()

src/VortexStepMethod.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export calculate_results, solve_circulation_distribution
2020
export add_section!, set_va!
2121
export calculate_span, calculate_projected_area
2222
export plot_wing, plot_circulation_distribution, plot_geometry, plot_distribution, plot_polars
23-
export show_plot, save_plot
23+
export show_plot, save_plot, menu
2424

2525
"""
2626
const MVec3 = MVector{3, Float64}
@@ -39,6 +39,10 @@ const VelVector=Union{MVec3, Vector, SizedVector{3, Float64, Vector{Float64}}}
3939

4040
abstract type AbstractWing end
4141

42+
function menu()
43+
Main.include("examples/menu.jl")
44+
end
45+
4246
# Include core functionality
4347
include("wing_geometry.jl")
4448
include("kite_geometry.jl")

0 commit comments

Comments
 (0)