Skip to content
This repository has been archived by the owner on Oct 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request #121 from PThorpe92/windows_ci
Browse files Browse the repository at this point in the history
chore: try to eliminate static openssl download for windows runner
  • Loading branch information
PThorpe92 authored Apr 5, 2024
2 parents 83a233a + df360f9 commit 3abbfe0
Show file tree
Hide file tree
Showing 11 changed files with 28 additions and 40 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,6 @@ jobs:
with:
toolchain: stable
override: true
- name: Install deps on Windows
if: runner.os == 'windows-latest'
run: |
vcpkg install openssl:x64-windows-static-md
- name: Install Deps On Linux
if: runner.os == 'Linux'
run: |
Expand Down
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "CuTE-tui" # crates.io/crates/CuTE is taken :(
version = "0.1.1"
version = "0.1.2"
authors = ["PThorpe92 <[email protected]>"]
description = "A (ratatui) TUI for HTTP requests with request + API key management"
license = "GPL-3.0"
Expand Down
2 changes: 0 additions & 2 deletions src/display/inputopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ pub enum InputOpt {
CaCert,
KeyLabel(i32),
ImportCollection,
CreateCollection,
RenameCollection(i32),
RequestError(String),
Method(Method),
Expand Down Expand Up @@ -66,7 +65,6 @@ impl Display for InputOpt {
InputOpt::FtpAccount => write!(f, "| FTP Account"),
InputOpt::KeyLabel(_) => write!(f, "| Key Label"),
InputOpt::ImportCollection => write!(f, "| Import Collection"),
InputOpt::CreateCollection => write!(f, "| Create Collection"),
InputOpt::RenameCollection(_) => write!(f, "| Rename Collection"),
InputOpt::RequestError(ref err) => write!(f, "| Error: {}", err),
InputOpt::Method(method) => write!(f, "| Method: {}", method),
Expand Down
3 changes: 1 addition & 2 deletions src/display/menuopts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,8 @@ pub const KEY_MENU_OPTIONS: [&str; 4] = [
"Copy to Clipboard 󰅎 ",
"Cancel  ",
];
pub const COLLECTION_MENU_OPTIONS: [&str; 4] = [
pub const COLLECTION_MENU_OPTIONS: [&str; 3] = [
"Import New Postman Collection 󰖟 ",
"Create New Collection 󰖟 ",
"View Collections 󱂛 ",
"Cancel  ",
];
Expand Down
35 changes: 21 additions & 14 deletions src/screens/collections.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use crate::display::menuopts::{
};
use crate::screens::render::handle_screen_defaults;
use crate::screens::{
centered_rect, input::input::handle_default_input_screen, render::render_header_paragraph,
ScreenArea,
centered_rect, input::input_screen::handle_default_input_screen,
render::render_header_paragraph, ScreenArea,
};
use tui::prelude::{Constraint, Direction, Layout, Margin};
use tui::style::{Color, Modifier, Style};
Expand All @@ -28,12 +28,10 @@ pub fn handle_collection_menu(app: &mut App, frame: &mut Frame<'_>, opt: Option<
match app.selected {
// Import New Collection
Some(0) => app.goto_screen(&Screen::SavedCollections(Some(InputOpt::ImportCollection))),
// Create New Collection
Some(1) => app.goto_screen(&Screen::SavedCollections(Some(InputOpt::CreateCollection))),
// View Saved Collections
Some(2) => app.goto_screen(&Screen::ViewSavedCollections),
Some(1) => app.goto_screen(&Screen::ViewSavedCollections),
// Cancel
Some(3) => {
Some(2) => {
app.goto_screen(&Screen::Home);
}
_ => {}
Expand Down Expand Up @@ -85,7 +83,7 @@ pub fn handle_collection_alert_menu(app: &mut App, frame: &mut Frame<'_>, cmd: i
let alert_text_chunk = Block::default()
.borders(Borders::ALL)
.style(Style::default().bg(Color::Black).fg(Color::LightGreen))
.title("Alert");
.title("Collection Menu");
let options_box = layout[1].inner(&Margin {
vertical: 1,
horizontal: 1,
Expand All @@ -110,13 +108,22 @@ pub fn handle_collection_alert_menu(app: &mut App, frame: &mut Frame<'_>, cmd: i
.constraints([Constraint::Percentage(50), Constraint::Percentage(50)].as_ref())
.split(alert_box)[1];
let selected = app.get_collection_by_id(cmd).unwrap_or_default();
let paragraph = Paragraph::new(format!("{:?}", selected.get_name()))
.block(
Block::default()
.borders(Borders::ALL)
.title("Request Collection"),
)
.alignment(tui::layout::Alignment::Center);
let count = app
.db
.get_number_of_commands_in_collection(cmd)
.unwrap_or_default();
let paragraph = Paragraph::new(format!(
"{:?}\nContains: {} {}",
selected.get_name(),
count,
if count == 1 { "request" } else { "requests" }
))
.block(
Block::default()
.borders(Borders::ALL)
.title("Request Collection"),
)
.alignment(tui::layout::Alignment::Center);
frame.render_widget(paragraph, cmd_str);
frame.render_widget(alert_text_chunk, alert_box);
frame.render_stateful_widget(list, options_box, &mut list_state);
Expand Down
12 changes: 0 additions & 12 deletions src/screens/input/input.rs → src/screens/input/input_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ pub fn get_input_prompt(opt: InputOpt) -> Text<'static> {
AuthType::Bearer => Text::from(INPUT_OPT_AUTH_BEARER),
_ => Text::from(INPUT_OPT_AUTH_ANY),
},
InputOpt::CreateCollection => Text::from("Enter a name for the new collection"),
InputOpt::CookiePath => Text::from("Enter the path to the cookie jar file"),
InputOpt::NewCookie => Text::from("Enter the name of the cookie"),
InputOpt::CookieValue(ref name) => Text::from(format!("Enter the value for {}", name)),
Expand Down Expand Up @@ -315,17 +314,6 @@ pub fn parse_input(message: String, opt: InputOpt, app: &mut App) {
app.goto_screen(&Screen::Success);
}
}
InputOpt::CreateCollection => {
if app.create_postman_collection(&message).is_ok() {
app.goto_screen(&Screen::SavedCollections(Some(InputOpt::RequestError(
"Successfully created collection".to_string(),
))));
return;
}
app.goto_screen(&Screen::SavedCollections(Some(InputOpt::RequestError(
"Failed to create collection".to_string(),
))));
}
InputOpt::KeyLabel(id) => match app.set_key_label(id, &message) {
Ok(_) => app.goto_screen(&Screen::SavedKeys),
Err(e) => app.goto_screen(&Screen::Error(e)),
Expand Down
2 changes: 1 addition & 1 deletion src/screens/input/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
pub mod input;
pub mod input_screen;

pub mod request_body_input;
2 changes: 1 addition & 1 deletion src/screens/input/request_body_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use tui::{
Frame,
};

use super::input::render_input_with_prompt;
use super::input_screen::render_input_with_prompt;

pub fn handle_req_body_input_screen(app: &mut App, frame: &mut Frame<'_>, _opt: InputOpt) {
let chunks = Layout::default()
Expand Down
2 changes: 1 addition & 1 deletion src/screens/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn handle_screen(app: &mut App, frame: &mut Frame<'_>, screen: Screen) {
Screen::Method => method::handle_method_select_screen(app, frame),
// INPUT SCREEN ****************************************************
Screen::InputMenu(opt) => {
input::input::handle_default_input_screen(app, frame, opt.clone());
input::input_screen::handle_default_input_screen(app, frame, opt.clone());
}
Screen::ViewBody => {
let area = centered_rect(frame.size(), ScreenArea::Center);
Expand Down
2 changes: 1 addition & 1 deletion src/screens/request.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use super::input::input::handle_default_input_screen;
use super::input::input_screen::handle_default_input_screen;
use super::render::handle_screen_defaults;
use crate::app::App;
use crate::display::inputopt::InputOpt;
Expand Down

0 comments on commit 3abbfe0

Please sign in to comment.