Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Windows builds #522

Merged
merged 7 commits into from
Apr 19, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# navi <img src="https://user-images.githubusercontent.com/3226564/65362934-b4432500-dbdf-11e9-8f75-815fbc5cbf8f.png" alt="icon" height="28px"/> [![Actions Status](https://github.com/denisidoro/navi/workflows/Tests/badge.svg)](https://github.com/denisidoro/navi/actions) ![GitHub release](https://img.shields.io/github/v/release/denisidoro/navi?include_prereleases)

TODO: windows
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove


An interactive cheatsheet tool for the command-line.

[![Demo](https://asciinema.org/a/406461.svg)](https://asciinema.org/a/406461)
Expand Down
16 changes: 6 additions & 10 deletions src/actor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::clipboard;
use crate::config::Action;

use crate::fs;
use crate::config::CONFIG;
use crate::env_var;
use crate::extractor;
Expand Down Expand Up @@ -65,6 +65,8 @@ fn prompt_finder(
('\n'.to_string(), &None)
};

eprintln!("{}", fs::exe_string()?);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove


let overrides = {
let mut o = CONFIG.fzf_overrides_var();
if let Some(io) = initial_opts {
Expand All @@ -78,15 +80,9 @@ fn prompt_finder(
let mut opts = FinderOpts {
overrides,
preview: Some(format!(
r#"navi preview-var "$(cat <<NAVIEOF
{{+}}
NAVIEOF
)" "$(cat <<NAVIEOF
{{q}}
NAVIEOF
)" "{name}"; {extra}"#,
r#"(@echo.{{+}}NAVIEOF{{q}}NAVIEOF{name}) | {exe} preview-var-win"#,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If windows... else...

exe = fs::exe_string()?,
name = variable_name,
extra = extra_preview.clone().unwrap_or_default()
)),
..initial_opts.clone().unwrap_or_default()
};
Expand All @@ -100,7 +96,7 @@ NAVIEOF

if opts.preview_window.is_none() {
opts.preview_window = Some(if extra_preview.is_none() {
format!("up:{}", variable_count + 3)
format!("up:{}", variable_count + 10)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3

} else {
"right:50%".to_string()
});
Expand Down
3 changes: 3 additions & 0 deletions src/config/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,9 @@ pub enum Command {
/// Typed text
variable: String,
},
/// Used for fzf's preview window when selecting variable suggestions
#[clap(setting = AppSettings::Hidden)]
PreviewVarWin,
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PreviewVarStdin

/// Outputs shell widget source code
Widget {
#[clap(possible_values = WIDGET_POSSIBLE_VALUES, case_insensitive = true, default_value = "bash")]
Expand Down
5 changes: 4 additions & 1 deletion src/handler/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ pub mod func;
pub mod info;
pub mod preview;
pub mod preview_var;
pub mod preview_var_win;
pub mod repo_add;
pub mod repo_browse;
pub mod shell;

use crate::config::Command::{Fn, Info, Preview, PreviewVar, Repo, Widget};
use crate::config::Command::{Fn, Info, Preview, PreviewVar, PreviewVarWin, Repo, Widget};
use crate::config::{RepoCommand, CONFIG};
use crate::handler;
use anyhow::Context;
Expand All @@ -20,6 +21,8 @@ pub fn handle() -> Result<()> {
Some(c) => match c {
Preview { line } => handler::preview::main(line),

PreviewVarWin => handler::preview_var_win::main(),

PreviewVar {
selection,
query,
Expand Down