Git Product home page Git Product logo

the-way's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

the-way's Issues

Unsupported: cannot change the io buffer size across restarts

Running any commands gives me this error: Unsupported: cannot change the io buffer size across restarts. please change it back to 8388608.

I've tried deleting ~/.config/the-way to no avail. This is version 0.7.0 on NixOS.

Running the same command with backtrace set to full gives:

Error: 
   0: Unsupported: cannot change the io buffer size across restarts. please change it back to 8388608

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   1: color_eyre::config::HookBuilder::install::{{closure}}::h89493c7b19a69a32
      at <unknown source file>
   2: the_way::the_way::TheWay::start::hea72f08e14a0d57d
      at <unknown source file>
   3: the_way::main::ha4dc93d41b39356d
      at <unknown source file>
   4: std::rt::lang_start::{{closure}}::hf19916ed3db71252
      at <unknown source file>
   5: std::rt::lang_start_internal::h7d1b27a1580794aa
      at <unknown source file>
   6: main
      at <unknown source file>
   7: __libc_start_main
      at <unknown source file>
   8: _start
      at <unknown source file>

Thanks!

Replace copy_to_clipboard code with arboard

arboard seems to do the right thing when it comes to X11 clipboard handling. Should allow replacing the current very ugly xclip/pbcopy hack in utils.rs. Also, replacing clipboard with arboard in tests/cli.rs should allow copy tests to run on Linux CI as well, which is ideal.

Add statistics

I'm thinking a graph with languages on the X-axis and number of snippets on the Y-axis (colored by github language colors). And then selecting a particular bar shows tags associated with the language and code stats using syntect:

synstats collects a bunch of statistics about the code in a folder. Includes basic things like line count but also fancier things like number of functions. Demonstrates how syntect can be used for code analysis as well as highlighting, as well as how to use the APIs to parse out the semantic tokenization.

Add Tests

Look at assert_cmd and the Testing page of the Rust CLI book.
-[ ] Make functions take a writer instead of printing.

  • Test all the command-line related functions.

build on Android

first thank you!
works great on my pc, tried building on aarch64 and as title says, it fails to build "skim", yet I can (and have) built & installed "skim" already.

Add language extension support when opening editor

the-way opens the user's editor of choice to paste/type in a code snippet. This editor should be opened with the correct language extension so that syntax highlighting works (if they are using an editor which supports it). This is hard-coded as ".rs" now for testing.

GitHub has this YML file that you can use to link the user-inputted language to the corresponding extension. If the language isn't found, default to txt (and maybe print a warning in case they've typed the name wrong?)

Sync and backup of database

The database directory contains several files:

image

I want to sync/backup the database across several machines, which of these files are important enough needs to be backed up for it to work? My current guess is that db should be enough, but the snap.* and conf also seem important. blobs is currently empty.

Could you please explain what these files are? And for future users - maybe add a README.md to that directory to help guide people who'll wonder the same.

(feature request) make better use of 'cmd' by allowing us to execute them.

Hi! (me again)
As a new user, seeing both add and cmd makes me think they are two different functions, but it appears they achieve the same thing, except that using cmd saves us one extra step as it automatically tags the language as 'sh', which is certainly nice to have, but not really a needed feature.
To make better use of this function, seeing as they are shell commands, allow us to execute them directly or clip them, that way our snippets are snippets and our cmds are one-liners!
On the same note, if they wasnt automatically tagged 'sh' anymore, cmds could be one-liners written in any non-compiled language, for example, I use this great one-liner as a quick way to setup python:

python3 -m ensurepip --default-pip && python3 -m pip3 install --upgrade pip setuptools wheel"

And this one sets up Perls better pkg manager:

curl -L https://cpanmin.us | perl - --sudo App::cpanminus

Would be nice to add these as cmds that I can execute directly, rather than copy and paste them back into the terminal to use.
Currently, my one-liners are saved as aliases, which isnt good as they are rarely used yet sourced everytime I open a new shell, when I do finally need to use them, I need to dig through a huge page of aliases, with the-way, I wouldnt need to do that anymore, plus aliases dont have metadata like the-way provides! (title, tags, description etc).
Thank you once again!

EDITOR with space

$ echo $EDITOR
vim -N -u NONE

$ RUST_BACKTRACE=1 the-way new                                                                                                                                               
✔ Description · cgo
✔ Language · go
✔ Tags (space separated) · 
✔ Code snippet (<RET> to edit in external editor) · 
Error: 
   0: No such file or directory (os error 2)

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 2 frames hidden ⋮                               
   3: the_way::utils::external_editor_input::hcbbab1d7fe9610eb
      at <unknown source file>
   4: the_way::the_way::snippet::Snippet::from_user::h807f2b0215308756
      at <unknown source file>
   5: the_way::the_way::TheWay::run::hc7651f9367a8cabe
      at <unknown source file>
   6: the_way::the_way::TheWay::start::hdaa9914ca7162356
      at <unknown source file>
   7: the_way::main::h54fb7cb483b9714d
      at <unknown source file>
   8: std::sys_common::backtrace::__rust_begin_short_backtrace::h1d6ae41c2286663c
      at <unknown source file>
   9: std::rt::lang_start::{{closure}}::h55da07d914c978cf
      at <unknown source file>
  10: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h5867dc20a6af6cac
      at /rustc/c71248b70870960af9993de4f31d3cba9bbce7e8/library/core/src/ops/function.rs:259
  11: std::panicking::try::do_call::h32e8dcce59f53a45
      at /rustc/c71248b70870960af9993de4f31d3cba9bbce7e8/library/std/src/panicking.rs:381
  12: std::panicking::try::h7d7b073280e6de2f
      at /rustc/c71248b70870960af9993de4f31d3cba9bbce7e8/library/std/src/panicking.rs:345
  13: std::panic::catch_unwind::h801333b3e4e7d79f
      at /rustc/c71248b70870960af9993de4f31d3cba9bbce7e8/library/std/src/panic.rs:382
  14: std::rt::lang_start_internal::h2c157bf657c6892a
      at /rustc/c71248b70870960af9993de4f31d3cba9bbce7e8/library/std/src/rt.rs:51
  15: main
      at <unknown source file>
  16: __libc_start_main
      at <unknown source file>
  17: _start
      at <unknown source file>

Suggestion: Set your default editor using the $EDITOR or $VISUAL environment variables

Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering.
Run with RUST_BACKTRACE=full to include source snippets.

This is a bug in console-rs/dialoguer#87

config giving error

the-way config default producing no output and giving following error.
Error:
0: Failed to read configuration file.

Panic if xclip is not installed

Trying to copy a snippet without xclip being installed leads to a panic

`❯ the-way search     
The application panicked (crashed).
Message:  Clipboard Error: 
   0: No such file or directory (os error 2)
Location: /home/peter/.cargo/registry/src/github.com-1ecc6299db9ec823/the-way-0.11.1/src/the_way/snippet.rs:259

Installing xclip solves the problem but required reading through the source to figure out. Would it be useful to add a probable cause to the expect error? Something like 'Clipboard Error - is xclip available?' would give users a clue what's up.

Fuzzy search across snippets

Use skim to perform fuzzy search across snippet descriptions (and everything else too? maybe this can be configurable?) and display results with matching portions highlighted.

Documentation: Theme format?

I see there's a folder to put themes in, but I can't seem to figure out what format a theme file should look like. Could this be documented somewhere?

Import from Gist

Expand the-way import to allow importing snippets from public Gists (keep link to original gist in description / tags). There's already a get_gist function in gist.rs which returns a gist with a description, a link, and a set of files each having their language and code content.

Can't install on linux

error: linking with `cc` failed: exit code: 1
  |
  = note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.0.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.1.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.10.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.11.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.12.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.13.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.14.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.15.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.2.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.3.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.4.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.5.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.6.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.7.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.8.rcgu.o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.the_way.ctflhgaz-cgu.9.rcgu.o" "-o" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc" "/tmp/cargo-installGSUmMc/release/deps/the_way-3472d7d8320a6bcc.4d07y1vnaaplmxnv.rcgu.o" "-Wl,--gc-sections" "-pie" "-Wl,-zrelro" "-Wl,-znow" "-Wl,-O1" "-nodefaultlibs" "-L" "/tmp/cargo-installGSUmMc/release/deps" "-L" "/tmp/cargo-installGSUmMc/release/build/onig_sys-f420966d2202a194/out" "-L" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "/tmp/cargo-installGSUmMc/release/deps/libsled-ba6f8961895f0a8a.rlib" "/tmp/cargo-installGSUmMc/release/deps/libfxhash-48ce744b4d51dfbe.rlib" "/tmp/cargo-installGSUmMc/release/deps/libparking_lot-8afe247720d86703.rlib" "/tmp/cargo-installGSUmMc/release/deps/libparking_lot_core-0ef62ee890e8d2ba.rlib" "/tmp/cargo-installGSUmMc/release/deps/libsmallvec-336e2f217eccb45c.rlib" "/tmp/cargo-installGSUmMc/release/deps/liblock_api-fbef896c318f2d45.rlib" "/tmp/cargo-installGSUmMc/release/deps/libfs2-db202d78c23936f2.rlib" "/tmp/cargo-installGSUmMc/release/deps/libconfy-562f042d87f227e6.rlib" "/tmp/cargo-installGSUmMc/release/deps/libtoml-d75b9e2e8e5df52c.rlib" "/tmp/cargo-installGSUmMc/release/deps/libdialoguer-92aaeab810f9171d.rlib" "/tmp/cargo-installGSUmMc/release/deps/libtempfile-e213a7ee79ebf1a3.rlib" "/tmp/cargo-installGSUmMc/release/deps/librand-d72096f80085bfa6.rlib" "/tmp/cargo-installGSUmMc/release/deps/librand_chacha-9212b9882db89498.rlib" "/tmp/cargo-installGSUmMc/release/deps/libppv_lite86-49ca1ed374d4e032.rlib" "/tmp/cargo-installGSUmMc/release/deps/librand_core-965b8291997f99b9.rlib" "/tmp/cargo-installGSUmMc/release/deps/libgetrandom-0fb3439aad28685b.rlib" "/tmp/cargo-installGSUmMc/release/deps/libremove_dir_all-9e028aba247074ba.rlib" "/tmp/cargo-installGSUmMc/release/deps/libconsole-5746ed2bf15e744b.rlib" "/tmp/cargo-installGSUmMc/release/deps/libtermios-f280fc78100e4a68.rlib" "/tmp/cargo-installGSUmMc/release/deps/libterminal_size-ca0bdcc6909b0617.rlib" "/tmp/cargo-installGSUmMc/release/deps/libclicolors_control-7d1a5e7f381887d3.rlib" "/tmp/cargo-installGSUmMc/release/deps/libclipboard-93510166e55d392d.rlib" "/tmp/cargo-installGSUmMc/release/deps/libx11_clipboard-f93079f117669bad.rlib" "/tmp/cargo-installGSUmMc/release/deps/libxcb-d15fb94d26152072.rlib" "/tmp/cargo-installGSUmMc/release/deps/libchrono_english-9ee276ed9bd1a712.rlib" "/tmp/cargo-installGSUmMc/release/deps/libscanlex-9ad6e5ac2c9b2bba.rlib" "/tmp/cargo-installGSUmMc/release/deps/libskim-585f8d9968861234.rlib" "/tmp/cargo-installGSUmMc/release/deps/libtimer-23be78d2c0801331.rlib" "/tmp/cargo-installGSUmMc/release/deps/librayon-927702667704d972.rlib" "/tmp/cargo-installGSUmMc/release/deps/librayon_core-36ef82e352e70426.rlib" "/tmp/cargo-installGSUmMc/release/deps/libnum_cpus-eaed19933d8f88b8.rlib" "/tmp/cargo-installGSUmMc/release/deps/libeither-f2d86e25b82d4b8b.rlib" "/tmp/cargo-installGSUmMc/release/deps/libfuzzy_matcher-bbebb943ac7975d8.rlib" "/tmp/cargo-installGSUmMc/release/deps/libregex-81d4178b2f8962cb.rlib" "/tmp/cargo-installGSUmMc/release/deps/libthread_local-fc63fcebf8b73330.rlib" "/tmp/cargo-installGSUmMc/release/deps/libaho_corasick-07a88fe11c6d04da.rlib" "/tmp/cargo-installGSUmMc/release/deps/libmemchr-03dd68b935356ed4.rlib" "/tmp/cargo-installGSUmMc/release/deps/libvte-bbf90183b1cb4aae.rlib" "/tmp/cargo-installGSUmMc/release/deps/libutf8parse-42ad76258505e597.rlib" "/tmp/cargo-installGSUmMc/release/deps/libtuikit-9da29f0fc7071cb3.rlib" "/tmp/cargo-installGSUmMc/release/deps/libterm-03fd2b6116272c7b.rlib" "/tmp/cargo-installGSUmMc/release/deps/libdirs-74613aac4f36a9ce.rlib" "/tmp/cargo-installGSUmMc/release/deps/libnix-a34bbee3b7060762.rlib" "/tmp/cargo-installGSUmMc/release/deps/libvoid-6f1b5af69e79a087.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcrossbeam-fb3643ccb5419932.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcrossbeam_queue-a52b5d9c19b13f93.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcrossbeam_channel-8a92d275e636d31e.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcrossbeam_deque-960c8b40ea23ef36.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcrossbeam_epoch-f87e1e937412c6ee.rlib" "/tmp/cargo-installGSUmMc/release/deps/libscopeguard-d37cc3f59d29c72c.rlib" "/tmp/cargo-installGSUmMc/release/deps/libmemoffset-a7d5f8dc51cd000e.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcrossbeam_utils-11da1951b6400f58.rlib" "/tmp/cargo-installGSUmMc/release/deps/libmaybe_uninit-03e7e44c90bd25c6.rlib" "/tmp/cargo-installGSUmMc/release/deps/liblog-b18cae863f2eb2dc.rlib" "/tmp/cargo-installGSUmMc/release/deps/libsyntect-6cdc128c592b1f69.rlib" "/tmp/cargo-installGSUmMc/release/deps/libonig-e7cd55a0c89e36ee.rlib" "/tmp/cargo-installGSUmMc/release/deps/libonig_sys-8f4004d6e3631a47.rlib" "/tmp/cargo-installGSUmMc/release/deps/liblazycell-011459db3edefd75.rlib" "/tmp/cargo-installGSUmMc/release/deps/libregex_syntax-696c905c813de01b.rlib" "/tmp/cargo-installGSUmMc/release/deps/libfnv-0afc1c3c8670000b.rlib" "/tmp/cargo-installGSUmMc/release/deps/libwalkdir-c4c820ddafb99795.rlib" "/tmp/cargo-installGSUmMc/release/deps/libsame_file-d8ee389a5c65c081.rlib" "/tmp/cargo-installGSUmMc/release/deps/libserde_json-e6b6dfdf99e97dbc.rlib" "/tmp/cargo-installGSUmMc/release/deps/libryu-31fa515732975246.rlib" "/tmp/cargo-installGSUmMc/release/deps/libitoa-2002907394290b24.rlib" "/tmp/cargo-installGSUmMc/release/deps/libplist-3174064bf347b3f9.rlib" "/tmp/cargo-installGSUmMc/release/deps/libchrono-d424ab81b2037d5e.rlib" "/tmp/cargo-installGSUmMc/release/deps/libnum_integer-e47d1f753e581e13.rlib" "/tmp/cargo-installGSUmMc/release/deps/libnum_traits-94ef367d06432fb1.rlib" "/tmp/cargo-installGSUmMc/release/deps/libtime-e034ffb6d8bf919c.rlib" "/tmp/cargo-installGSUmMc/release/deps/libline_wrap-086f0e413fb23767.rlib" "/tmp/cargo-installGSUmMc/release/deps/libsafemem-810bfb6b848d6def.rlib" "/tmp/cargo-installGSUmMc/release/deps/libxml-d2d101afa567e18a.rlib" "/tmp/cargo-installGSUmMc/release/deps/libbase64-89aed2ceaa414602.rlib" "/tmp/cargo-installGSUmMc/release/deps/libindexmap-fc7d0830fc52bacc.rlib" "/tmp/cargo-installGSUmMc/release/deps/libflate2-a2d3749775585dbd.rlib" "/tmp/cargo-installGSUmMc/release/deps/libminiz_oxide-0a3b2b46325fa3a5.rlib" "/tmp/cargo-installGSUmMc/release/deps/libadler32-78818f129f1dbeae.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcrc32fast-a89903f6c0925906.rlib" "/tmp/cargo-installGSUmMc/release/deps/libbincode-51a635eda363546a.rlib" "/tmp/cargo-installGSUmMc/release/deps/libbyteorder-fde23484a8b5a556.rlib" "/tmp/cargo-installGSUmMc/release/deps/libserde_yaml-54416473be46c0cf.rlib" "/tmp/cargo-installGSUmMc/release/deps/libdtoa-0f66ed98988a1868.rlib" "/tmp/cargo-installGSUmMc/release/deps/libyaml_rust-8492468ecd97a1bf.rlib" "/tmp/cargo-installGSUmMc/release/deps/liblinked_hash_map-2efe9b219378fbf5.rlib" "/tmp/cargo-installGSUmMc/release/deps/libserde-69e7dafec0f127c8.rlib" "/tmp/cargo-installGSUmMc/release/deps/libhex-9992cbf5225293db.rlib" "/tmp/cargo-installGSUmMc/release/deps/libthiserror-9ad7cc1c3f97bcef.rlib" "/tmp/cargo-installGSUmMc/release/deps/libdirectories-f2f3e9f28a99941f.rlib" "/tmp/cargo-installGSUmMc/release/deps/libdirs_sys-b96aee8ef131a06f.rlib" "/tmp/cargo-installGSUmMc/release/deps/libcfg_if-9f036fcde4cc67a7.rlib" "/tmp/cargo-installGSUmMc/release/deps/libstructopt-9d54e4114dfcce32.rlib" "/tmp/cargo-installGSUmMc/release/deps/liblazy_static-01801b14b1194c31.rlib" "/tmp/cargo-installGSUmMc/release/deps/libclap-88550781f2239d5a.rlib" "/tmp/cargo-installGSUmMc/release/deps/libvec_map-f12d4ed507e63416.rlib" "/tmp/cargo-installGSUmMc/release/deps/libtextwrap-3860312a3021fbe7.rlib" "/tmp/cargo-installGSUmMc/release/deps/libunicode_width-40222abe6159473b.rlib" "/tmp/cargo-installGSUmMc/release/deps/libstrsim-d8c107ec29d5e6b5.rlib" "/tmp/cargo-installGSUmMc/release/deps/libbitflags-4a618b80d8b97a23.rlib" "/tmp/cargo-installGSUmMc/release/deps/libatty-550c06aa5f19bf3f.rlib" "/tmp/cargo-installGSUmMc/release/deps/liblibc-f215c2e0329f7e8e.rlib" "/tmp/cargo-installGSUmMc/release/deps/libansi_term-835ef610ea445dff.rlib" "/tmp/cargo-installGSUmMc/release/deps/libanyhow-7e8e68315e2f46d2.rlib" "-Wl,--start-group" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-2ba7334df39d2f7a.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-657e4d155bb4e6cf.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libhashbrown-74e4c636b9d7ea05.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_alloc-0221cbee9c7577cd.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace-c960a04d1d345808.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libbacktrace_sys-8958546759d14758.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_demangle-222e0898c427d4ea.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-cbb111037f32a181.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcfg_if-3d7b2b621df05c0d.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-05d437c0517adf5b.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-1a0136457c801f96.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_std_workspace_core-4de9036d0cd84bfb.rlib" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-a66b64bb03b02c03.rlib" "-Wl,--end-group" "/home/biridir/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-6db43a0120d5caa9.rlib" "-Wl,-Bdynamic" "-lc" "-lxcb" "-lxcb" "-lxcb" "-lxcb" "-lxcb-render" "-lxcb-shape" "-lxcb-xfixes" "-lutil" "-ldl" "-lutil" "-ldl" "-lrt" "-lpthread" "-lgcc_s" "-lc" "-lm" "-lrt" "-lpthread" "-lutil" "-ldl" "-lutil"
  = note: /usr/bin/ld: cannot find -lxcb-shape
          /usr/bin/ld: cannot find -lxcb-xfixes
          collect2: error: ld returned 1 exit status
          

error: aborting due to previous error

error: failed to compile `the-way v0.2.1`, intermediate artifacts can be found at `/tmp/cargo-installGSUmMc`

Caused by:
  could not compile `the-way`.

To learn more, run the command again with --verbose.

Also Travis CI build fail on linux targets with:

error: failed to run custom build command for `xcb v0.8.2`

Caused by:

  process didn't exit successfully: `/target/debug/build/xcb-642392b748273c1b/build-script-build` (exit code: 101)

--- stderr

thread 'main' panicked at 'Unable to find build dependency python3: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /cargo/registry/src/github.com-1ecc6299db9ec823/xcb-0.8.2/build.rs:67:26

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Add gist sync from the-way produced gist

Allow the-way import -w <gist-url> to import from a Gist produced by the-way sync which has an index.md file with descriptions and tags linked to snippet_<index>.<extension> files. These snippets would be added to existing snippets (so <index> is ignored.

Also, add tags to index.md file in Gist

Panic after adding an Elixir snippet

It seems the txt fallback is not working for me.

Steps to reproduce:

  • the-way new
  • Add a snippet for a language without syntax highlight support e.g. Elixir
  • the-way search

Using find_syntax_by_extension("txt") instead of find_syntax_by_extension(".txt") seems to fix it.

Import/Export Format

Markdown with a specific format sounds nice for export (along with JSON ofc):

# Snippet <index> :tags:
<description>
<code>

Hmm, on second thought this looks more like org mode.

Import can just be JSON I think.

Add syntax-highlighted terminal output

Use syntect to display a snippet on the terminal with the correct syntax highlighting. This may link back to some code in Issue #1 for determining the language/extension name to pass to syntect.

Couldn't build automated binaries for Linux when using clipboard dependency

Travis CI build fails on linux targets with:

error: failed to run custom build command for `xcb v0.8.2`

Caused by:

  process didn't exit successfully: `/target/debug/build/xcb-642392b748273c1b/build-script-build` (exit code: 101)

--- stderr

thread 'main' panicked at 'Unable to find build dependency python3: Os { code: 2, kind: NotFound, message: "No such file or directory" }', /cargo/registry/src/github.com-1ecc6299db9ec823/xcb-0.8.2/build.rs:67:26

note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

But cargo install works on Linux so this should be fixable somehow.

Configuration

Add a configuration file (using confy?)

  • database directory
  • syntax highlighting theme
  • theme directory

poor readability of highlighted item in light themes

Hello! I've tried all built-in light themes and they all suffer same issue, that is poor readability of highlighted item in fuzzy pane. Following is InspiredGitHub theme, but others light themes have more or less same issue.

Screenshot-2020-07-02-at-20-43-32.png

Indexed required argument not working

Previously, writing:

- import:
      about: "Imports code snippets from a JSON file"
      display_order: 2
      args:
        - json:
            index: 1
            short: j
            value_name: JSON_FILE
            takes_value: true
            required: true
            help: "filename to import snippets from"

would allow a user to call the-way import filename without having to write the-way import -j filename. This seems to be broken now. Had to remove the index: 1 and use the more verbose call.

YAML file needs to be different on Linux and Mac

Subcommand argument description:

  • In Mac
        - on:
            long: on
            value_name: DATE
            help: "Snippets on <DATE>"
  • In Linux
        - on:
            long: on
            value_name: DATE
            about: "Snippets on <DATE>"

help doesn't work on Linux and about doesn't work on Mac when building from source

Sync as gist

Really liking the sync option in Pet, the-way sync could do something similar

Param input and output rendering incorrectly

A couple of things I have noticed with a couple of snippets I have made. When using a snippet with a <param> and sending it to /dev/null 2>&1 & (background job), the param is not being captured correctly or sending to output correctly. For example, when using this specific snippet: aria2c --on-download-complete="/tmp/notify.sh" -s16 -x16 <download-link> > /tmp/aria.log 2>&1 &

The input renders as: ? download-link> > /tmp/aria.log 2 and the output as: aria2c --on-download-complete="/tmp/notify.sh" -s16 -x16 <download-link>&1 &

Last, it also seems that only works with the-way cmd and not when using the default editor to create a snippet. Is that intended? If not, then is there a way to allow this? I can create the command prior to adding it as a snippet cmd, but it kind of seems like it would defeat the purpose for some. Not such a big deal though.

Highlight parameters in shell snippet when copying

Copying a shell snippet with parameters in it looks like this currently:

image

Would be nice to highlight the <param> and <param=name> portions differently. This would mean additional parameters to Snippet's copy function - two colors (one for the highlighted portion and one for the rest) according to the selected theme, and highlighting using the as_24_bit_terminal_escaped function from syntect.

Both the copy command and search command use this code so both need to be addressed.

Make it easier to save and run shell snippets

Inspiration from pet for this.

  • the-way cmd that takes code as first argument (to pipe in with a bash function) and doesn't ask for language.
  • parameterized code with variables <param> or <param=default> that are filled in interactively when the snippet is copied.

screencast is all buggy

Just need to make a screencast and not fiddle around with the settings until it breaks, should be easy.

Sync Error

Tried using the-way sync and pasting the Github token with gists enabled, but getting this returned:

Error:
0: SyncError: "422 {"message":"Validation Failed","errors":[{"resource":"Gist","code":"missing_field","field":"files"}],"documentation_url":"https://docs.github.com/v3/gists/#create-a-gist\"}"

Suggestion: Make sure your GitHub access token is valid.
Get one from https://github.com/settings/tokens/new (add the "gist" scope).
Set it to the environment variable $THE_WAY_GITHUB_TOKEN

Backtrace omitted.
Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.

Also added the token into a env var as suggested, but same error is thrown.

the-way search: add option to use stderr for interface, directly output snippet

When using the-way in the shell using the-way search, finding a snippet is very convenient, but then it gets copied to the clipboard.

I'd much prefer an option that would just output the snippet to stdout. That way I could bind the-way to some key combination in bash and then directly get the snippet on the command line, maybe even automatically pressing enter.
That would probably require the interface of the-way to print to stderr.

Database overwritten when adding new item

Each time I run the-way new and add an item, it overwrites my DB and I end up with one item.

Repro steps:

  1. the-way new and fill in all fields with test
  2. the-way new and fill in all fields with test2
    • The output says Added snippet #1 a second time
  3. the-way list and confirm that only the last snippet has persisted

Repro recording: https://asciinema.org/a/qVGPLqqeFmo8YxCeK5LhoQuQ9

I'm using the-way v0.24.0 on MacOS v10.15.4 with rust v1.40.0 and I installed through cargo.

test change_snippet fails

Output from running tests.

running 8 tests
test add_snippet ... ignored
test change_config_file ... ok
test import_multiple_no_tags ... ok
test import_single_show ... ok
test it_works ... ok
test delete ... ok
test change_theme ... test change_theme has been running for over 60 seconds
test change_snippet ... test change_snippet has been running for over 60 seconds
test change_snippet ... FAILED
test change_theme ... ok

failures:

---- change_snippet stdout ----
thread 'change_snippet' panicked at 'assertion failed: change_snippet_rexpect(config_file, &executable_dir).is_ok()', tests/cli.rs:175:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    change_snippet

test result: FAILED. 6 passed; 1 failed; 1 ignored; 0 measured; 0 filtered out

Replace syntect with bat for syntax highlighting?

Pros:

  • you could show line numbers and then have an option to only copy certain lines? (this sounds slightly overkill)
  • takes language name as input instead of extension so could remove the code that maps languages to extensions

Cons:

  • not super clear how to add and set highlighting themes
  • syntect seems better documented as it's meant to be used as a crate. bat is more of a cli tool which also happens to be a crate. Not sure if this is a valid con since you're also using skim.

Editing a snippet in an editor

When editing an existing snippet (the-way search -> select -> shift+right), after confirming the other fields, the prompt says Code snippet (<RET> to edit in external editor). What is <RET> in this case? Return/enter appears to only submit the snippet as it is.

I have tried with $EDITOR both unset and set to vi.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.