Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
95c394cbaf | ||
|
3637091341 | ||
|
4b8087bf8d | ||
|
3471ea3c0b | ||
|
bdd28da59e |
15
.drone.yml
15
.drone.yml
@ -29,7 +29,20 @@ steps:
|
|||||||
# source: dist/**/*
|
# source: dist/**/*
|
||||||
# target: live-cli/${DRONE_BUILD_CREATED}-${DRONE_COMMIT}
|
# target: live-cli/${DRONE_BUILD_CREATED}-${DRONE_COMMIT}
|
||||||
|
|
||||||
- name: Gitea Artifacts
|
- name: Publish Artifacts
|
||||||
|
image: curlimages/curl
|
||||||
|
volumes:
|
||||||
|
- name: dist
|
||||||
|
path: /dist
|
||||||
|
environment:
|
||||||
|
GITEA_SVC_USERNAME:
|
||||||
|
from_secrete: GITEA_SVC_USERNAME
|
||||||
|
GITEA_SVC_PASSWORD:
|
||||||
|
from_secret: GITEA_SVC_PASSWORD
|
||||||
|
commands:
|
||||||
|
- sh -c 'set -ex; cd /dist; for f in *; do curl --user "drone-svc:$${GITEA_SVC_PASSWORD}" -X PUT https://gitea.austen-wares.com.com/api/packages/public/generic/$${DRONE_REPO_NAME}/$$(date -Isecond)-$${DRONE_COMMIT}/$${f}; done'
|
||||||
|
|
||||||
|
- name: Publish release
|
||||||
image: plugins/gitea-release
|
image: plugins/gitea-release
|
||||||
when:
|
when:
|
||||||
event:
|
event:
|
||||||
|
14
src/main.rs
14
src/main.rs
@ -190,7 +190,7 @@ fn main() -> Result<()> {
|
|||||||
let (message_rx, command_request_tx) = init_message_passing();
|
let (message_rx, command_request_tx) = init_message_passing();
|
||||||
|
|
||||||
// Run the actual application
|
// Run the actual application
|
||||||
let app = App::new(message_rx, command_request_tx, text_orig);
|
let mut app = App::new(message_rx, command_request_tx, text_orig);
|
||||||
enable_raw_mode()?;
|
enable_raw_mode()?;
|
||||||
let mut stdout = io::stdout();
|
let mut stdout = io::stdout();
|
||||||
execute!(
|
execute!(
|
||||||
@ -202,7 +202,7 @@ fn main() -> Result<()> {
|
|||||||
let backend = CrosstermBackend::new(stdout);
|
let backend = CrosstermBackend::new(stdout);
|
||||||
let mut terminal = Terminal::new(backend)?;
|
let mut terminal = Terminal::new(backend)?;
|
||||||
|
|
||||||
let res = run_app(&mut terminal, app);
|
let resulting_commandline = run_app(&mut terminal, &mut app);
|
||||||
|
|
||||||
// Restore terminal
|
// Restore terminal
|
||||||
disable_raw_mode()?;
|
disable_raw_mode()?;
|
||||||
@ -214,11 +214,13 @@ fn main() -> Result<()> {
|
|||||||
)?;
|
)?;
|
||||||
terminal.show_cursor()?;
|
terminal.show_cursor()?;
|
||||||
|
|
||||||
let res = res?;
|
let resulting_commandline = resulting_commandline?;
|
||||||
|
|
||||||
if let Some(res) = res {
|
if let Some(resulting_commandline) = resulting_commandline {
|
||||||
std::io::stderr().write_all(res.as_bytes())?;
|
// TODO: I do not want to collect the whole thing into a vec
|
||||||
|
app.command_options.read().command_result.as_ref().map(|r| std::io::stdout().write_all(&r.stdout.bytes().collect::<Vec<u8>>())).transpose()?;
|
||||||
std::io::stderr().write_all(b"\n")?;
|
std::io::stderr().write_all(b"\n")?;
|
||||||
|
std::io::stderr().write_all(resulting_commandline.as_bytes())?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
@ -248,7 +250,7 @@ fn init_message_passing() -> (Receiver<EventMessage>, Sender<CommandRequest>) {
|
|||||||
|
|
||||||
#[allow(clippy::too_many_lines)]
|
#[allow(clippy::too_many_lines)]
|
||||||
#[cfg_attr(debug_assertions, instrument(skip(terminal, app)))]
|
#[cfg_attr(debug_assertions, instrument(skip(terminal, app)))]
|
||||||
fn run_app<B: Backend>(terminal: &mut Terminal<B>, mut app: App) -> Result<Option<String>> {
|
fn run_app<B: Backend>(terminal: &mut Terminal<B>, app: &mut App) -> Result<Option<String>> {
|
||||||
// When starting the app, ensure the command runs at least once
|
// When starting the app, ensure the command runs at least once
|
||||||
{
|
{
|
||||||
let mut command_options = app.command_options.write();
|
let mut command_options = app.command_options.write();
|
||||||
|
Loading…
Reference in New Issue
Block a user