mgunyho / tere

Terminal file explorer
European Union Public License 1.2
1.67k stars 36 forks source link

Add skip first run prompt cli flag #104

Closed timon-schelling closed 6 days ago

timon-schelling commented 1 week ago

Adds a --skip-first-run-prompt flag. "Disables the welcome message shown on the first launch of tere, which prompts the user to update their shell configuration for proper directory changing functionality. Use this flag if you have already configured your shell or want to bypass the prompt for other reasons."

See https://github.com/timon-schelling/tere/commit/eba404900fb2fcf74f150d3ff97ce382bf1e34aa#comments for the discussion that lead up to this.

@mgunyho The first commit contains all feature relevant code. In the second commit I've updated the textwarp dependency, otherwise I'm not able to build master or this pr. error on master:

error[E0635]: unknown feature `stdsimd`
  --> /home/codespace/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ahash-0.7.6/src/lib.rs:33:42
   |
33 | #![cfg_attr(feature = "stdsimd", feature(stdsimd))]
   |                                          ^^^^^^^

For more information about this error, try `rustc --explain E0635`.
error: could not compile `ahash` (lib) due to 1 previous error

After updating textwarp I get a failing test both on main plus the second commit and for this pr. RUST_BACKTRACE=1 cargo test --no-fail-fast --locked:

failures:

---- app_state::tests::test_case_sensitive_mode_change stdout ----
thread 'app_state::tests::test_case_sensitive_mode_change' panicked at src/app_state.rs:1711:9:
assertion `left == right` failed
  left: [1]
 right: [2]
stack backtrace:
   0: rust_begin_unwind
             at /rustc/c2f74c3f928aeb503f15b4e9ef5778e77f3058b8/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_fmt
             at /rustc/c2f74c3f928aeb503f15b4e9ef5778e77f3058b8/library/core/src/panicking.rs:74:14
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed
             at /rustc/c2f74c3f928aeb503f15b4e9ef5778e77f3058b8/library/core/src/panicking.rs:367:5
   4: tere::app_state::tests::test_case_sensitive_mode_change
             at ./src/app_state.rs:1711:9
   5: tere::app_state::tests::test_case_sensitive_mode_change::{{closure}}
             at ./src/app_state.rs:1696:41
   6: core::ops::function::FnOnce::call_once
             at /rustc/c2f74c3f928aeb503f15b4e9ef5778e77f3058b8/library/core/src/ops/function.rs:250:5
   7: core::ops::function::FnOnce::call_once
             at /rustc/c2f74c3f928aeb503f15b4e9ef5778e77f3058b8/library/core/src/ops/function.rs:250:5

I guess this could be a rustc version mismatch but I'm not sure. What rustc version are you building against? Is this test working on master for you?

timon-schelling commented 1 week ago

could this be related? https://github.com/mgunyho/tere/issues/90

mgunyho commented 1 week ago

Thanks! I'll look at the PR later today.

That's strange with the build errors. I tried now on master with rustc 1.77.1 (7cf61ebde 2024-03-27) (on Fedora 40) and it worked fine. I'll try to update rustc and see if it fails after that.

The failure of test_case_sensitive_mode_change indeed seems to be the same as #90, and it's still a mystery to me.

mgunyho commented 1 week ago

The tests work fine for me also on rustc 1.81.0 (eeb90cda1 2024-09-04) (although I get a couple of new warnings).

timon-schelling commented 1 week ago

I tried it on GitHub code space and had the same problems like I described

timon-schelling commented 1 week ago

Do you have suggestions on how to move forward? #90 seems to be environment dependent, as a test that should not be. On NixOS I'm able to build and run all tests. See https://github.com/timon-schelling/timonos/blob/7ed1566c035a98bcec317974698ff6f0060e70ae/overlays/tere/overlay.nix I'm really confused.

mgunyho commented 1 week ago

Hi, I checked your code and the PR looks good! Thanks for also including the tests. Could you please

  1. rebase on to develop (that branch already has the update of textwrap to 0.16, although I couldn't reproduce the compilation issue you had) and
  2. write a short note in CHANGELOG.md?

I'll then make a new release over the weekend.

The mysterious failling test is the same as #90 so we can leave that for the future.