Closed Sispheor closed 7 years ago
OK, the custom-dir should already allowing me that. Following the doc..
I don't know why, my file is listed in eg --list
, but when I run eg <myfile>
I have no output.
All files in my custom-dir are ignored. They appear in the list but no output for all of them.
Here an example of file
# SSL/TLS
check a ca certificate againt URL
openssl s_client -CApath ca_cert.crt -connect https://url.example
Check a Certificate Signing Request (CSR)
openssl req -text -noout -verify -in CSR.csr
Check a private key
openssl rsa -in privateKey.key -check
Check a certificate
openssl x509 -in certificate.crt -text -noout
# Generateate a self signed certificate
Generate private key
openssl genrsa -out ca.key 2048
Generate CSR
openssl req -new -key ca.key -out ca.csr
Generate Self Signed certificate
openssl x509 -req -days 365 -in ca.csr -signkey ca.key -out ca.crt
# Others
Get CA certificate from server
echo -n | openssl s_client -connect 37.59.53.15:443 | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > /tmp/ca.cert
I'm on the last eg release 1.0.0 installed from pip.
Custom files are supposed to appear before default files in the output, but both should be present. Their content will be separated by ---
. I have some custom awk
examples, eg, and this is my output from eg awk
(truncated):
# Print All Fields
Print all fields:
awk -F: ' { for (i = 1; i < NF; i++) print $i }'
Split lines into field on `:` (`-F:`).
Print all fields using a for loop. `NF` is the number of fields in the line,
`print $2` will print the second field.
This command will print your path, assuming it is colon-delimited:
echo $PATH | awk -F: ' { for (i = 1; i < NF; i++) print $i }'
---
# awk
print lines matching `foo`
awk '/foo/' input.txt
match foo, split on whitespace, and print the first element in the split array
awk '/foo/ { print $1 }' input.txt
This is my egrc
:
[eg-config]
custom-dir = ~/dotfiles/eg/custom_files
[color]
heading = '\x1b[38;5;172m'
My extra awk
content is in ~/dotfiles/eg/custom_files/awk.md
.
Can you post:
egrc
ls
output of your custom directoryeg --list
Hi thanks for your answer
cat .egrc
[eg-config]
pager-cmd = 'less -RMFK'
custom-dir = ~/Documents/snippets
Content of ~/Documents/snippets
ls ~/Documents/snippets
git.md ip.md iptables.md ldap.md ssl.md
List from eg
Programs supported by eg:
adb
----- TRUNCATED ---
git *
ip *
iptables +
ldap +
ssl +
----- TRUNCATED ---
Not that it works for IP and GIT, the content of my file has been added to the original one. But for LDAP, SSL and Iptable, they are listed but I have no output at all.
When you say "but both should be present." You mean that if I want to have a personal content, I need to add into an existing file provided by eg?
Hmm nothing looks amiss to me there...
For most use cases (at least that I'm aware of), personal content should go in your custom directory. If you add content for a command that ships with eg
, you should see both pieces of content concatenated together. Since git *
is output from your eg --list
command, eg
is correctly noting that you have some custom git
examples and that it also ships with git
examples.
Based on the config you've provided, the output of eg git
for you should be:
<the contents of ~/Documents/snippets/git.md>
---
<the default git examples>
It sounds like that is working for you, right?
The +
in the output of eg --list
is supposed to indicate that examples have been added (+
) rather than modified (*
) by the custom directory. Again based on your config, eg ssl
should show the contents of your file ~/documents/snippets/ssl.md
and nothing else.
*It sounds like you are seeing expected behavior for commands that show `, but getting no output for commands that show
+`, is that correct?**
If so, a few more questions:
aliases.json
or something? This is unlikely, but just in case.pager-cmd
? I thought I understood the X
option on your other issue, but messing around with it I'm not sure I do. Maybe something is going on there that we're not handling gracefully. Try removing it from your egrc
temporarily.eg ssl
?which -a eg
?eg --pager-cmd 'cat' ssl
? Still no output?Yes, if I have a custom content it works.
pager-cmd
set in the egrc!The weird thing is that the X
parameter doesn't disturb the program when I want to show a default example like awk.
To summarize, when I use this config: pager-cmd = 'less -RMFK'
custom-dir
Is it a length of file thing? If less
doesn't have to do any paging (ie it all fits on the screen at once) it terminates. Otherwise, you have to page. Maybe the X
flag is opening less
, paging the content, exiting less
, then clearing the screen. If you make your terminal shorter does eg ssl
work with your pager-cmd
?
You are right, I've added some lines into the SSL file and it works.
I removed the F
flag(Scroll forward) and it works normally.
Sorry for having disturbed you with that. This is totally not a eg bug :)
Thank you for this tool anyway !
Interesting. No worries and glad to hear it's resolved!
If I understand well, the
custom-dir
override a md file that is in thedefault-dir
.If I override the default-dir, I'll lose every md file pre installed by eg. Right?
From my understanding, I cannot have personal md files and keep the defaults one in the same time.