----BEGIN CLASS---- [14:08] #startclass [14:08] Roll Call [14:08] Kushal Das [14:08] kiyo [14:08] nagarajan [14:09] Yo, only 2 people :) [14:09] Anyway, did you install cargo/rustlang via the URL I provided? [14:09] yes [14:09] yes [14:10] Perfect. [14:10] Today we will just learn about a few newer tools written in Rust. [14:10] If you like them, you can use, otherwise you can just delete the executables from ~/.cargo/bin/ directory :) [14:10] 1. cargo install bat [14:10] ! [14:11] It will download all the dependencies and install [14:11] next [14:11] does rust have a version manager like node nvm? the setup feels similay [14:11] similar* [14:11] kiyo, no, it works in a different way. [14:12] It is not downloading sources to store in a directory per project, instead it is downloading and compiling the final executable as we want. [14:12] The cargo tool downloads from https://crates.io/crates/bat [14:12] ^^ in our case. [14:12] ok [14:13] Let me know when you have it ready. [14:14] its ready [14:14] bat /etc/os-release [14:14] done [14:15] or download a big HTML file, say: curl -o /tmp/planet.html https://planet.dgplug.org [14:15] and then bat /tmp/planet.html [14:15] You can use the standard search method by pressing / and then the string to search. [14:16] hmmm i seem to have installed something else [14:16] sorry [14:16] ! [14:16] kiyo, ? [14:16] nect [14:16] next [14:17] I worked it out. ubuntu saves the command as batcat [14:19] kiyo, from the cargo command? [14:19] yes [14:19] Ah, I learned something new [14:19] bat cannot be found [14:19] but on ubuntu it seems to be batcat [14:19] he must have already installed bat from apt, i have the same too [14:19] *bat cannot be found [14:19] kiyo, oh, do you have ~/.cargo/bin/ in PATH? [14:20] kiyo, show the output of echo $PATH [14:21] home/kiyo/.nvm/versions/node/v16.16.0/bin:/home/kiyo/kde/src/kdesrc-build:/home/kiyo/emsdk:/home/kiyo/emsdk/upstream/emscripten:/home/kiyo/emsdk/node/14.15.5_64bit/bin:/home/kiyo/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin [14:21] kiyo, yup, you are correct. I just now found it in the README. [14:21] (replace bat with batcat if you are on Debian or Ubuntu) [14:22] The README actually shows many options/features bat has. [14:22] Have a look and try a few of those :) [14:22] i have both installed bat and batcat, both working fine [14:24] ! [14:25] next [14:25] where can i find readme [14:25] circuitlover, https://crates.io/crates/bat from here [14:25] ok sorry [14:26] circuitlover, hehe, no issues :) [14:26] circuitlover, This is part of learning, how to find the source of a project. [14:27] I tired "tail -f ./package.json | batcat --paging=never -l log" [14:27] saw it change on each save... quite cool [14:27] kushal: yeah understood :) [14:27] Next tool: ripgrep. [14:27] cargo install ripgrep [14:28] the actual command is rg. [14:28] ! [14:28] I can not remember the find command syntax much, I use rg everywhere. [14:28] next [14:28] i must have miss read something [14:29] cargo is a pkg manager? should i be using it for these pkgs and not my os? [14:31] ok i have installed bat with cargo too :D [14:31] kiyo, generally you should use your OS's package manager for the tools, but I wanted to show the cargo command itself :) [14:31] kiyo, we can use cargo to build any Rust project from source (git checkout) [14:31] ok thanks [14:32] so time to try rg command :) [14:33] And it seems I am sleepy enough to say "rg" is a replacement for find, but it is for grep :) [14:33] Try to search any string even from your home directory, it is fast :) [14:34] + [14:34] ! [14:34] https://github.com/BurntSushi/ripgrep this is the project repository. [14:34] next [14:35] it looks like grep can i use it like find? [14:35] i was searching for a file name [14:35] kiyo, no, for find replace I will show next :) [14:36] kiyo, circuitlover, let me know when you tried rg :) [14:37] yes done. it looks like a fancy grep [14:37] rg is great xO, displaying with line numbers from all types of files [14:38] yes done :) [14:38] cargo install fd-find [14:38] ^^ though the command is "fd" [14:38] Use that like: fd py [14:38] kiyo, ^^ this is your find replacement :) [14:41] Let me know after you try it :) [14:41] Remember to use -H to search for hidden files too :) [14:43] hmm [14:43] done [14:43] i hardly ever use find but the one command i do know is ~$ find . -name "globmyFileglob" [14:43] That is still long :p [14:44] but -name is not found for fd [14:44] kiyo, yes, just type fd name [14:44] fd text [14:44] like that [14:44] cargo install exa [14:44] yes thats better than the original find [14:45] exa is the ls replacement. [14:45] original find was just forgettable for day to day stuff... haha [14:45] cargo install exa [14:47] done [14:47] done [14:47] try it out [14:48] alias ls=/home/kdas/.cargo/bin/exa [14:48] ^^ this helps to use it even more :) [14:48] similar: alias cat="/home/kdas/.cargo/bin/bat -p" [14:49] ! [14:49] next [14:49] yes nice and user-friendly :) [14:50] feels like there has been alot of effort to set up a userland built on rust [14:50] Yes. [14:50] is there a long term project to build a fully rust os? [14:50] kiyo, https://www.redox-os.org/ [14:51] is it angood? [14:51] any good* [14:51] No clue for users, but must be really good to learn how to write one :) [14:51] haha yes... [14:52] cargo install zoxide [14:53] ^^ this is one tool I really like. [14:53] https://github.com/ajeetdsouza/zoxide [14:55] great, cd with memory :) [14:56] haha, that is a nice definition :) [14:56] hmmm this time it doesn't work for me. [14:56] yes me too, z command not found [14:56] z: command not found [14:57] I have to pop out for 5 mins sorry [14:57] I wont be late :) [14:58] kiyo, yes, because there is a setup required :) [14:58] I wanted to see if you are going to read the readme :) [14:58] kiyo, circuitlover https://github.com/ajeetdsouza/zoxide#step-2-add-zoxide-to-your-shell [14:59] now working [14:59] have to add shell [14:59] kushal: :) [15:00] it has lots of integrations, great :) [15:02] There is still starship, mcfly :) [15:02] I like https://starship.rs/ a lot :) [15:02] Try these out slowly. [15:03] installing it right away :) [15:03] ok sure [15:03] circuitlover, do you have any other question? otherwise we can end the session :) [15:03] no questions, will ask later after the session [15:05] Okay. [15:05] #endsession [15:05] No roll call? [15:05] No roll call :) ----END CLASS----