Coder Social home page Coder Social logo

Comments (13)

snshn avatar snshn commented on July 19, 2024 1

Glad to hear. I'd like to keep it open until there's a support for an input file and/or config in Monolith, if you don't mind.

from monolith.

snshn avatar snshn commented on July 19, 2024

Hello Yuri,

that sounds like a good idea! I believe it can be achieved by using cat and some other methods, described here: https://www.baeldung.com/linux/file-line-command-argument

Please let me know if it works.

from monolith.

htcrefactor avatar htcrefactor commented on July 19, 2024

I came here to see if this feature was suggested by anyone. Great idea!

from monolith.

yufio avatar yufio commented on July 19, 2024

@snshn yeah, that most likely would work.

What I'd love to have is not to have to do it at all.
I'd rather just run monolith https://lyrics.github.io/db/P/Portishead/Dummy/Roads/ -o portishead-roads-lyrics.html and automatically apply the blacklist from the file (that for example is in the same dir as monolith with default name blacklist.txt). I now reread the initial comment and I see I didn't mention that.

I am not an avid shell user so I spent around 15 min to try to come up with an actual example how cat would work and I couldn't 🙈. I guess it would save some time for people like me to be able to just run monolith -B blacklist_permissive.txt https://lyrics.github.io/db/P/Portishead/Dummy/Roads/ -o portishead-roads-lyrics.html.

from monolith.

htcrefactor avatar htcrefactor commented on July 19, 2024

Maybe the contents of blacklist_permissive.txt can be fed to the -B options?

I can't guarantee, but for example, ls -a -l and ls $(options.txt) ls $(cat options.txt) look identical, assuming options.txt is as below.

options.txt

-a
-l

If you have a list of domains to block, can you try and tell me if this works?
Your command should look something like monolith -I -B -d $(blacklists.txt)monolith -I -B -d $(cat blacklists.txt).

(I updated my comment to fix a mistake)

from monolith.

yufio avatar yufio commented on July 19, 2024

@htcrefactor which terminal emulator do you use? I tried echo $(blacklist.txt) in zsh and bash on MacOS but I get zsh/bash: command not found: blacklist.txt

from monolith.

htcrefactor avatar htcrefactor commented on July 19, 2024

I've tested it on the default terminal emulator for Ubuntu 22.04 (Jammy), but I need to figure out what it is. I'll make sure to get back to you with more information later.

from monolith.

yufio avatar yufio commented on July 19, 2024

@htcrefactor not urgent or important. Please take your time and thanks for looking into it.

from monolith.

htcrefactor avatar htcrefactor commented on July 19, 2024

Maybe monolith -I -B -d $(cat blacklists.txt) may work for you? This also looks more correct and compliant.

I found a relevant concept called command substitution in GNU's bash manual. According to the manual, ls -a -l, ls $(cat options.txt), and ls $(< options.txt) are all equal commands (when the previous assumption on options.txt are held valid).

I've tested it on Git Bash via Microsoft Terminal on Windows 11. Have a look at the below screenshot.

image

from monolith.

htcrefactor avatar htcrefactor commented on July 19, 2024

I fixed my previous comment(quoted below) because it was incorrect.

Maybe the contents of blacklist_permissive.txt can be fed to the -B options?

I can't guarantee, but for example, ls -a -l and ls $(options.txt) ls $(cat options.txt) look identical, assuming options.txt is as below.

If you have a list of domains to block, can you try and tell me if this works? Your command should look something like monolith -I -B -d $(blacklists.txt)monolith -I -B -d $(cat blacklists.txt).

from monolith.

yufio avatar yufio commented on July 19, 2024

@htcrefactor
this is what I tried but it doesn't seem to work
monolith -I -B -d $(cat blacklist.txt) -o humans-are-not-automatically-strategic.html https://www.lesswrong.com/posts/PBRWb2Em5SNeWYwwB/humans-are-not-automatically-strategic

error: Found argument 'https://www.lesswrong.com/posts/PBRWb2Em5SNeWYwwB/humans-are-not-automatically-strategic' which wasn't expected, or isn't valid in this context

USAGE:
    monolith [OPTIONS] <target>

For more information try --help

Same for: monolith -I -B -d $(cat blacklist.txt) https://www.lesswrong.com/posts/PBRWb2Em5SNeWYwwB/humans-are-not-automatically-strategic -o humans-are-not-automatically-strategic.html

error: Found argument 'https://www.lesswrong.com/posts/PBRWb2Em5SNeWYwwB/humans-are-not-automatically-strategic' which wasn't expected, or isn't valid in this context

USAGE:
    monolith [OPTIONS] <target>

For more information try --help

from monolith.

snshn avatar snshn commented on July 19, 2024

It looks like you might need to place -d prior to every line extracted from blacklist.txt...
Possibly xargs could be used as described here https://unix.stackexchange.com/questions/393351/pass-contents-of-file-as-argument-to-bash-script but I think it may be way simpler than that.

Something like this:
echo $(awk 'NF {print "-d " $0}' blacklist.txt)

This seems to be working:
monolith -I -B $(awk 'NF {print "-d " $0}' blacklist.txt) https://www.lesswrong.com/posts/PBRWb2Em5SNeWYwwB/humans-are-not-automatically-strategic -o humans-are-not-automatically-strategic.html

from monolith.

yufio avatar yufio commented on July 19, 2024

@snshn Yep, that worked. Thanks for looking into it.
I guess if we leave this for posterity the feature request can be closed 🤷‍♂️

from monolith.

Related Issues (20)

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.