Code Monkey home page Code Monkey logo

dwim-shell-command's Introduction

๐Ÿ‘‰ Support my work via GitHub Sponsors

Hi, Iโ€™m รlvaro ๐Ÿ‘‹

dwim-shell-command's People

Contributors

bram85 avatar damiencassou avatar kartiku avatar saucoide avatar vellvisher avatar xenodium avatar

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  avatar

dwim-shell-command's Issues

Embark integration

It would be nice to have a way to easily (or even automatically) integrate the existing commands with embark.

Eshell integration

Hi!

It would be great if this package had eshell integration so that I could run elisp functions on the files.

I didn't see any mention of it in the readme or any issue.

Is there a way to do this?

Thanks!

quoting around complex noweb template use is unclear

Consider the following defun:

    (defun dwim-shell-command-thumbnail-with-ffmpeg ()
      "Generate a thumbnail with ffmpeg."
      (interactive)
      (dwim-shell-command-on-marked-files
       "Thumbnail with ffmpeg"
       " ffmpeg -i '<<f>>' -vf  \"thumbnail,scale=640:360\" -frames:v 1 '<<td>>/<<fne>>.png'"
       :utils "ffmpeg"
       :silent-success t))

This fails with dwim-shell-command--escaped-quote-around: Couldnโ€™t figure out how to quote for " ffmpeg -i '<<f>>' -vf "thumbnail,scale=640:360" -frames:v 1 '<<td>>/<<fne>>.png'" using / and .

If instead the command is " ffmpeg -i '<<f>>' -vf \"thumbnail,scale=640:360\" -frames:v 1 '<<fne>>.png'", (ie, omitting the temporary directory), this succeeds.

how does <> work? omitting the explicit / path separator doesn't seem to matter, nor does hardcoding a /tmp/ instead of using <<td>>.

(my actual goal here is to generate temporary thumbnails for videos, so what i really want is something like " ffmpeg -i '<<f>>' -vf \"thumbnail,scale=640:360\" -frames:v 1 '<<td>>/<<fne>>.png' && feh <<td>>/<<fne>>.png", but omitting the && ... clause doesn't affect the error here. I'm also a little curious about how to use <>; maybe i can just pipe the png into feh and avoid the file entirely, but i don't know how.)

How to use it with scp

I'm trying to write a function using this tool to copy files over an ssh connection. Here is what I'm trying to achieve:

  • Using Dired tramp to navigate to a remote machine.
  • Trying to call the following function on a remote file
(defun my/dwim-shell-command-copy-from-remote-dir ()
    "Convert all marked videos to optimized gif(s)."
    (interactive)
    (dwim-shell-command-on-marked-files
     "Copy to local"
     "scp <<f>> ~/"))
  • The library gives an error that says '/ssh:[email protected]:/home/tareef/file.org': No such file or directory

The scp tool expects a path that starts with username@ip, but the <<f>> path starts with /ssh:, which makes the command fails.

What is the proper way to handle this situation?

fails with "Kill ring is empty" when the killring is empty :)

When there is nothing on the killring, anything that calls to dwim-shell-command--expand-file-template fails with that error, even if <<cb>> is not being used

it comes from (current-kill 0) in:

  (setq template (replace-regexp-in-string "\\(\<\<cb\>\>\\)" (or (current-kill 0)
                                                              (user-error "Nothing in clipboard"))

as long as you copy anything it works fine, but tripped me out when things stopped working on a recently restarted machine :)

I can reproduce it doing (setq kill-ring nil) and then running a dwim-shell-command

dwim-shell-comands-open-externally stopped working on linux

Hi, not sure at what point it started to happen but dwim-shell-commands-open-externally doesnt seem to work anymore on linux (on macos it does work) the function runs and seems to complete successfully but nothing really happens

running xdg-open from the terminal does work, and running it from dired as !xdg-open also works so i think it's something with dwim-shell-command, but i couldn't pinpoint exactly what it is

happy to help if there is anything i can do
thanks!

Symbol's function definition is void: string-replace

๐Ÿ‘‹ --

I'm a doom-emacs user (as such, as you can imagine, I don't have very good understanding of how packages get loaded, etc.)

I wanted to try out this package, but I ran into some trouble. I don't think it's necessarily an issue with dwim-shell-command - (I could be doing something wrong), but also, I figured you could help.

Basically, whenever I run a command, I get the error: Symbol's function definition is void: string-replace

  • Indeed, when I run describe-function, string-replace is not defined.
  • I don't see it defined in your package.
  • I tried re-evaluating all the (require ___) statements that your package depends on, thinking maybe there was something about how I included your package that the dependencies weren't run (or that I didn't have them on my system). But all the require statements happily evaluated, and string-replace is still not defined.
  • I also looked through your dotfiles to see if it was maybe something you defined on your instance, and I didn't seen anything there.

So, what am I missing? Where does string-replace come from?

Thanks for your help ๐Ÿ˜„

optionally quote <<*>> expansion for pathological filenames

when using dwim-shell-command with dired to mark and operate on multiple files with horrible names like foo (1).zip or november '21 datasheet.xls, no quoting is applied in the <<*>> noweb form. Could this become an option? Right now, you'll get errors like zsh:1: unmatched ' instead.

Add option to clean up the output buffers when the shell command succeeded

I would love to see an user option like dwim-shell-command-delete-succeded-buffers which deletes the buffers which can be nil by default. At the end of the day, I have many of those buffers open: โœ… *Clone dwim-shell-command* done and I very rarely, if ever, need to check the buffer when the process succeeded - but entirely different story when it failed.

What do you think?

`get-text-property` returns `nil` and breaks `dwim-shell-commands-macos-open-with`

When I run dwim-shell-commands-open-with, the segment (get-text-property 0 'path selection) returns nil and the command can't execute. The error output looks like:

+zsh:1> open -a nil /Users/tdstoff/Pictures/logos/AIAA_logo.jpg
Unable to find application named 'nil'

If I replace that segment with selection it works, even just working on the current buffer. Is anything besides selection actually needed?

This command is great BTW, one step closer to 100% living in Emacs.

Surprising behaviour when `default-directory` is bound

I have some commands, that I want to run in a project root, and I'm primarily interested in the std out/err of them. When I bind default-directory to project root what happens is:

  • a dired buffer is popped (with a directory of containing the file that was visited when the command has been called).
  • buffer of the command output does not exist.

An example command, that exhibits this behaviour is:

(defun dwim-shell-command-hello-world-in-project-root ()
  (interactive)
  (let ((default-directory (project-root (project-current))))
    (dwim-shell-command-execute-script "hello world"
                                       "echo \"[$(pwd)] Hello World!\"")))

As a workaround I'm using injection of the project root into the script, like in the following example:

(defun dwim-shell-command-hello-world-in-project-root ()
  (interactive)
  (let ((project-root (project-root (project-current))))
    (dwim-shell-command-execute-script
     "hello world"
     (format "cd '%s'
              echo \"[$(pwd)] Hello World!\""
             project-root))))

However, I think I prefer the former solution better. It's not only shorter, but I think more robust as well, i.e., it's easy to forget about quoting the argument to cd (would that prevent all corner cases?).

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.