mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 10:50:00 +00:00
Add an example using bash and jq
This commit is contained in:
parent
d0f953f0e5
commit
672c95db42
2 changed files with 50 additions and 0 deletions
36
examples/bash/simple_input.sh
Executable file
36
examples/bash/simple_input.sh
Executable file
|
@ -0,0 +1,36 @@
|
|||
#!/bin/bash -e
|
||||
# LICENSE BEGIN
|
||||
# This file is part of the SixtyFPS Project -- https://sixtyfps.io
|
||||
# Copyright (c) 2021 Olivier Goffart <olivier.goffart@sixtyfps.io>
|
||||
# Copyright (c) 2021 Simon Hausmann <simon.hausmann@sixtyfps.io>
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
# This file is also available under commercial licensing terms.
|
||||
# Please contact info@sixtyfps.io for more information.
|
||||
# LICENSE END
|
||||
|
||||
OUTPUT=$(sixtyfps-viewer - --save-data - << EOF
|
||||
import { StandardButton, GridBox, LineEdit } from "sixtyfps_widgets.60";
|
||||
_ := Dialog {
|
||||
property name <=> name-le.text;
|
||||
property address <=> address-le.text;
|
||||
StandardButton { kind: ok; }
|
||||
StandardButton { kind: cancel; }
|
||||
preferred-width: 300px;
|
||||
GridBox {
|
||||
Row {
|
||||
Text { text: "Enter Your name"; }
|
||||
name-le := LineEdit { }
|
||||
}
|
||||
Row {
|
||||
Text { text: "Address"; }
|
||||
address-le := LineEdit { }
|
||||
}
|
||||
}
|
||||
}
|
||||
EOF
|
||||
)
|
||||
NAME=$(jq -r ".name" <<< "$OUTPUT")
|
||||
ADDRESS=$(jq -r ".address" <<< "$OUTPUT")
|
||||
|
||||
echo "Your name is $NAME and you live in $ADDRESS!"
|
Loading…
Add table
Add a link
Reference in a new issue