Skip to main content

Get the Reddit app

Scan this QR code to download the app now
Or check it out in the app stores
r/commandline icon
r/commandline icon

r/commandline

members
online







Thrilled to share the new crossplatform version of tdlib-rs 🦀 Thrilled to share the new crossplatform version of tdlib-rs 🦀

Hey Guys!
We are so excited to tell you that we released a new version of tdlib-rs, now we now support up to td version 1.8.29.

For those who don't know it, tdlib-rs is a wrapper around the telegram c++ library. Perfect to create telegram client or telegram bot very simply. It can be integrated with the tokio runtime and allows you to receive all telegram updates and manage it asynchronously. For other additional information please don't hesitate to ask. Something is explained in the README of the project.

We pride ourselves on having numerous features unlike other libraries:

  1. It is cross-platform, it works on Windows (x86_64), Linux (x86_64) and MacOS (x86_64 and arm64).

  2. Not required pkg-config to build the library and associated exported variables.

  3. Not required tdlib to be compiled and installed on the system.

  4. It is possible to download the tdlib library from the GitHub releases.

In addition, I share a TUI for telegram written in rust (tgt) that we are developing using this library!

Any improvements or contributions are welcome, in both projects! ❤️‍🔥


Thrilled to share the new crossplatform version of tdlib-rs 🦀 Thrilled to share the new crossplatform version of tdlib-rs 🦀

Hey Guys!
We are so excited to tell you that we released a new version of tdlib-rs, now we now support up to td version 1.8.29.

For those who don't know it, tdlib-rs is a wrapper around the telegram c++ library. Perfect to create telegram client or telegram bot very simply. It can be integrated with the tokio runtime and allows you to receive all telegram updates and manage it asynchronously. For other additional information please don't hesitate to ask. Something is explained in the README of the project.

We pride ourselves on having numerous features unlike other libraries:

  1. It is cross-platform, it works on Windows (x86_64), Linux (x86_64) and MacOS (x86_64 and arm64).

  2. Not required pkg-config to build the library and associated exported variables.

  3. Not required tdlib to be compiled and installed on the system.

  4. It is possible to download the tdlib library from the GitHub releases.

In addition, I share a TUI for telegram written in rust (tgt) that we are developing using this library!

Any improvements or contributions are welcome, in both projects! ❤️‍🔥


Introducing Clipper - A Handy Command-Line Clipboard Tool Introducing Clipper - A Handy Command-Line Clipboard Tool

Hey everyone, I wanted to share something I've been working on that has made my workflow a lot smoother - it's called Clipper. 🎉

Why Clipper?

So, I often find myself needing to quickly copy things to my clipboard while working in the terminal. Whether it's the contents of a file, the output of a command, or just some random text, I wanted a simple tool that could handle it all, regardless of whether I'm on Linux, macOS, or Windows.

What Clipper Does

Clipper is a lightweight command-line tool that lets you copy content to your clipboard easily. Here's what makes it cool:

  • Cross-Platform Compatibility: Works on Linux, macOS, and Windows.

  • Simple Usage: Copy file contents, command outputs, or direct text with ease.

  • Fast and Efficient: No unnecessary overhead, just quick performance.

  • No External Dependencies: A standalone binary, so you don't need to worry about additional libraries or tools.

How to Get Clipper

Getting started with Clipper is super easy. Just run this command in your terminal:

curl -sSL https://raw.githubusercontent.com/supitsdu/clipper/main/install.sh | sh

Check It Out!

If you're interested, you can find the project on GitHub here: supitsdu/clipper

I'd love to hear what you think and if you find it as handy as I do. Feel free to drop any feedback or suggestions. Happy clipping! ✂️😊




Adding signal sign to the terminal Adding signal sign to the terminal

I travel a lot on train. On large parts of the travel, there is no internet reception. As I'm using a hotspot (from my phone) the Wi-Fi icon on my Mac does not indicate when the reception is not existing. So, I'm using ping to track the reception on my Mac's terminal.
I wonder if instead of keeping a tab in my terminal with the ping running, there is a way to show if there is a reception in a more concise but visual manner in the terminal.

I created the following function which I added to zshrc and then added it to the p10k prompt:

function check_internet() {
    ping -c 1 -W 1 8.8.8.8 > /dev/null 2>&1
    if [ $? -eq 0 ]; then
        echo "%F{green}•%f"
    else
        echo "%F{red}•%f"
    fi
}

Only problem it that when there is no reception any new line (even just calling 'cd') gets a second of delay which is not ideal.

I'm using kitty terminal emulator, with zsh and powerline10k theme on a MacBook.



Problem with winget in a cmd script Problem with winget in a cmd script

I have a bootstrap script which does a lot of things to setup a new Windows installation. It calls other scripts within that script, including this one which installs some packages using winget:

@echo off

:: Install essential packages
winget install -e --id Git.Git
winget install -e --id Google.Chrome
winget install -e --id Logitech.OptionsPlus
winget install -e --id M2Team.NanaZip
winget install -e --id Microsoft.PowerToys
winget install -e --id Microsoft.VCRedist.2015+.x64
winget install -e --id Microsoft.VCRedist.2015+.x86
winget install -e --id Microsoft.WindowsTerminal
winget install -e --id Mozilla.Firefox
winget install -e --id Notion.Notion
winget install -e --id SomePythonThings.WingetUIStore
winget install -e --id WinDirStat.WinDirStat --include-unknown
winget install -e --id WinSCP.WinSCP
winget install -e --id chrisant996.Clink
winget install -e --id gerardog.gsudo
winget install -e --id hluk.CopyQ
winget install -e --id qutebrowser.qutebrowser -l "C:\Program Files\qutebrowser"
winget install -e --id vim.vim

It installs every up to Notion and then install WingetUIStore, but that takes quite a long time (I know this as it starts running when it finally does intstall), but then the next 6 packages are skipped and only vim gets installed after that. Running the script again installs the 6 missing packages.

Why is this happening and what can I do about it?



Thoughts, tips, and customization of fzf for old-school CLI enjoyers? Thoughts, tips, and customization of fzf for old-school CLI enjoyers?

Hey,

As an avid CLI user, I always aimed to master non-interactive tools to perform most of my work, given that they are easy to use, create, extend, and connect.

However, I found myself dealing with software projects with many files (mostly under the yoke of corporate oppression; an ordeal which I endure to sustain myself, as most of those reading me do, and therefore I will not go further into this topic) and started to hit the limits of non-interactive tools to find and edit files. Indeed, I could go faster if I followed the temptation of monstrous IDEs, as I did in my innocent past.

I did not despair, as naturally I heard of the usefulness of interactive fuzzy finders such as fzf. After spending an afternoon evaluating the tool, I concluded that it indeed increases the complexity of my workflow. Still, this complexity is managed in a sensible way that follows the UNIX tradition.

I now ask you two general questions:

  • Did you reach similar conclusions to me and decide to use interactive fuzzy finders to solve working on software projects with many files?

  • If you use fzf or similar tools, what can you tell me about your workflow? Any other third-party tools? Do you integrate it into your scripts? Any advice that you can give me out of a long time of experience using the tool that is not easily conveyed by the documentation?

I also ask this very specific question:

  • The one part of fzf which I found missing was a way to interact with the results of grep, and to automatically place the selected file(s) in the prompt or an editor. For that, I created the following two commands. Do you have a similar workflow when you want to bring the speed of fuzzy finding to grep?

#! /usr/bin/env bash

# gf: grep + fzf
# basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d:'

# print usage on -h/--help
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
    echo "Usage: gf <grep-args>"
    echo
    echo "~~~ that feel when no 'gf' ~~~"
    echo
    echo "- Basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d:'"
    echo "- Opens fzf with grep results, and prints the selected filename(s)"
    echo "- Note: As this is meant to search files, it already adds the -r flag"
    echo
    echo "Example:"
    echo "  $ nvim \`gf foobar\`"
    echo "  $ gf foobar | xargs nvim"
    exit 0
fi

# run grep with arguments, pipe to fzf, and print the filename(s) selected
custom_grep () {
    grep -E --color=always --binary-files=without-match --recursive "$@"
}
remove_color () {
    sed -E 's/\x1b\[[0-9;]*[mK]//g'
}
custom_fzf () {
    fzf --ansi --height ~98%
}

grep_output=$(custom_grep "$@")
if [[ "$?" -ne 0 ]]; then
    exit 1
else
    echo "$grep_output" | custom_fzf | remove_color | cut -f 1 -d:
fi
#! /usr/bin/env bash

# ge: grep + fzf + editor
# basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d: | $EDITOR'

# print usage on -h/--help
if [[ "$1" == "-h" || "$1" == "--help" ]]; then
    echo "Usage: ge <grep-args>"
    echo
    echo "- Basically a wrapper for 'grep <ARGS> | fzf | cut -f 1 -d: | \$EDITOR'"
    echo "- Opens fzf with grep results, and edits the selected file(s)"
    echo "- Note: As this is meant to search files, it already adds the -r flag"
    echo "- Note: Internally, it uses the 'gf' command"
    echo
    echo "Example:"
    echo "  $ ge foobar"
    exit 0
fi

# takes output from 'gf' and opens it in $EDITOR
grep_fzf_output=$(gf "$@")
if [[ -n "$grep_fzf_output" ]]; then
  $EDITOR "$grep_fzf_output"
fi

Have a wonderful day, you CLI cowboys.





GoStyle / Pretty Color Library for Console Applications GoStyle / Pretty Color Library for Console Applications

EvilBytecode/GolangStyle: GolangStyle, best looking go library. (github.com)

Features?

  • Hide Console Cursor

  • Show Console Cursor

  • Clear Console (cls)

  • Static Colors

  • Gradient Colors (Transitions -> Blue to Purple)

  • Center Text

  • Init (ANSI color support, no color bugs)

  • ONLY WINDOWS (NO LINUX SUPPORT YET)

Why this has been made?

  • For developers that make some tools, or any kind of console applications.