2
0
mirror of https://github.com/chubin/cheat.sheets synced 2024-11-19 03:25:44 +00:00
Commit Graph

719 Commits

Author SHA1 Message Date
Igor Chubin
62156f41b3
Merge pull request #140 from raymondchen625/master 2020-11-20 02:33:33 +01:00
Raymond
4fb06be49c Add yq sheet 2020-11-19 20:22:35 -05:00
Igor Chubin
6510bc7fb6 Fix comment line length 2020-11-18 17:50:29 +01:00
Igor Chubin
6bb1e0153c Fix comment line length 2020-11-18 17:41:25 +01:00
Igor Chubin
dcea8d1745 Fix comment line length 2020-11-18 17:24:28 +01:00
Igor Chubin
c4ca01581d
Merge pull request #138 from terminalforlife/master
Improve `lenchk` and Fix Some Line Lengths
2020-11-18 16:59:02 +01:00
terminalforlife
a0c4be1552 Correct how less(1) is used, & catch more(1) bug
The `-r` flag isn't best here. Per the less(1) man page, it's best to
use `-R` to only display the ANSII color escape sequences.

It seems like more(1) doesn't support color escape sequences, or at
least not properly. The display is messed up when using more(1), so
I've just accounted for that. In this situation, just use the `-C`
flag(s).
2020-11-18 14:48:14 +00:00
terminalforlife
bf73be6b35 Look instead for '# cheat.sh: ' on any line
This is in regards to a request by Chubin on #134.

I didn't use grep(1), because it wound up being a lot slower than my
method. Relying on tools like that isn't always the best choice, which
is why I often just write in pure-shell, and have done for a couple of
years now. There's a time and a place for those external tools, but I
feel this was not it.

Tested and worked well. I've actually seen no noteworthy slowdowns, -
despite pre-processing the files -- YMMV.
2020-11-18 14:26:50 +00:00
terminalforlife
49be860e84 Fix line length of dpkg-deb & add header stuff 2020-11-18 12:40:43 +00:00
terminalforlife
dbae4e99c4 Fix line length of system_profiler 2020-11-18 12:36:25 +00:00
Igor Chubin
e1324e278f
Merge pull request #137 from chubin/len80
Fix comment line length
2020-11-18 07:48:49 +01:00
Igor Chubin
ee7879177a Fix comment line length 2020-11-18 07:48:19 +01:00
Igor Chubin
e54de05828
Merge pull request #136 from chubin/len80 2020-11-17 21:51:34 +01:00
Igor Chubin
c05a3214b0 Fix comment lenth in sheets/drutil 2020-11-17 20:29:09 +01:00
Igor Chubin
7330d636cc Fix comment lenth in sheets/rclone 2020-11-17 20:28:44 +01:00
Igor Chubin
2321ec7b43 Fix comment lenth in sheets/sysrq-trigger 2020-11-17 20:28:30 +01:00
Igor Chubin
827f498778
Merge pull request #135 from terminalforlife/master
Allow in-file disabling of lenchk (#134)
2020-11-17 20:07:15 +01:00
terminalforlife
2e8aee7eeb Fix line length of taste & tweak it slightly 2020-11-17 17:02:28 +00:00
terminalforlife
a3f21c156d Fix line length of wacaw 2020-11-17 17:00:53 +00:00
terminalforlife
442e7e2f93 Fix line length of http 2020-11-17 16:59:16 +00:00
terminalforlife
1223da5389 Fix line length of doas & slightly tweak 2020-11-17 16:57:03 +00:00
terminalforlife
dce972441d Fix line length of launchctl 2020-11-17 16:48:58 +00:00
terminalforlife
4225af3a91 Fix line length of systemd-sysvinit -- overhaul
To whomever wrote this originally: please check I didn't acidentally
order something in the wrong place. Awesome cheat sheet, by the way.

I did away with the table format as it just wasn't going to work
properly in keeping with the line length limit of 80.
2020-11-17 16:30:02 +00:00
terminalforlife
eff4e22ee3 Fix line length of umask 2020-11-17 16:00:31 +00:00
terminalforlife
c69c73059d Fix line length of xfs_repair 2020-11-17 15:58:46 +00:00
terminalforlife
c42bd33f46 Fix line length of xm 2020-11-17 15:58:06 +00:00
terminalforlife
2c4bcb2b39 Fix line length of ObjectOrientation 2020-11-17 15:49:51 +00:00
terminalforlife
5970584c88 Fix line length of PatternMatching 2020-11-17 15:48:29 +00:00
terminalforlife
2ece746c3a Address recursion line length (slight reword) 2020-11-17 15:45:38 +00:00
terminalforlife
aea321e9f0 Fix line length of types (tidied up table) 2020-11-17 15:42:28 +00:00
terminalforlife
a461a0c912 Hush cd, just in-case we get noise 2020-11-17 15:39:05 +00:00
terminalforlife
acebbe0d67 No longer need to be in 'tests' directory
Your BASH version is checked; if it's 3, you will have to ignore this
commit, unfortunately. To be fair, if you're on 3 (major), you have
more pressing matters. :P
2020-11-17 15:28:53 +00:00
terminalforlife
380b52688d Colorize by default, now that we're portable
This can still be disabled, though.
2020-11-17 15:17:42 +00:00
terminalforlife
edf22b3dd9 Colorization is now portable, thanks to tput(1) 2020-11-17 15:14:52 +00:00
terminalforlife
9191dafe36 Add ability to ignore the special lenchk line 2020-11-17 14:43:19 +00:00
terminalforlife
a5ac924841 Allow in-file disabling of lenchk (#134) 2020-11-17 14:34:44 +00:00
Igor Chubin
5b98860f73
Merge pull request #134 from terminalforlife/master 2020-11-17 05:21:49 +01:00
terminalforlife
a7dbcd06d7 Handle user's own provided directories 2020-11-17 02:33:10 +00:00
terminalforlife
1e7c9ae57e Use more(1) as a fallback for paging 2020-11-17 02:12:54 +00:00
terminalforlife
66a38b7196 Tighten Main(), and use pager by default
The use of `[ -t 1 ]` won't check for interactivity, rather, whether
STDOUT is viable? If so, it might be best to check the `$-` variable
(I think that's it) for the `i` character, like the standard default
Debian `.bashrc` interactivity checks. Or, my preference, check the
`$PS1` is not empty, which works well in my own `.bashrc` file.

The `Main()` function was spread a bit too far, but is now more
appropriate; has no real impact, just clarify when reading.

Although the use of less(1) pager is enabled by default, it can be
disabled now with the `--no-pager|-P` flags.
2020-11-17 02:09:38 +00:00
terminalforlife
17454dc8f4 Add whitelisting functionality
We can now specify our own whitelisting file, overriding the default of
'lenchk-excludes' which must stay in the same directory as lenchk, at
least for now. The custom file can be wherever you want it, however.

I'd like to use the `readarray`/`mapfile` BASH built-in for populating
the array variable, but it didn't seem to want to work, so I just went
for another `while read` loop. It's working very nicely as-is, though.

I've changed the required whitelist format to one of simplicity: one
filename per line. Why the previous format? Because of files which may
have a newline character in them, but I realised in this environment
that's just not going to happen; force of habit, I guess.

I'd like to allow users to be able to whitelist entire directories, but
I don't see that being so high on the priority list, for now.

What do you think?
2020-11-17 01:49:52 +00:00
terminalforlife
6ef4f6e9fc Add option to ignore 'sheets/*/*' subdirectories 2020-11-17 00:56:16 +00:00
terminalforlife
2bc31bd7dc Address less-related bug regarding summary 2020-11-17 00:48:59 +00:00
Igor Chubin
81f234e0eb
Merge pull request #133 from terminalforlife/master
Add lenchk (tester to replace max_length)
2020-11-16 22:56:48 +01:00
terminalforlife
6de63e8df8 Correct spelling errors (duh!) 2020-11-16 21:24:14 +00:00
terminalforlife
9bd8c37f8a Correct Err() instance (wrong directory name) 2020-11-16 21:22:49 +00:00
terminalforlife
fa546de881 Add lenchk (max_length functionality, and some)
Hope this helps. I wish I'd known this is what you were after, but I
guess it didn't click! This is an area I love and excel at, so I
hoped to put that to use here.

* The colorization flag might help when there are a lot of results.

* By far, the indented line number and preview of the offending lines
  is the most useful aspect of lenchk, making it much easier to track
  down troublesome lines, especially for the inexperienced.

* I've accounted for `//` lines (C languages), although some like
  Javascript, HTML, and CSS I've yet to get around to.

* There's a summary, which is probably pointless, but it might help to
  keep track of our progress in getting through the files.

* It's ever-so-slightly more efficient and portable, but ultimately, -
  I'd say making it use just /bin/sh would be better, but Bash is
  pretty common-place these days, and has features which make lenchk
  much cleaner.

  Ideally, I'd have written this in Perl, due to the limited lifespan
  of this tester, because a shell can only handle so much data before
  it starts to chug. I figured, however, that not everyone will have
  Perl.

If this commit isn't accepted, no worries, as I'm sure I can repurpose
it for use elsewhere.

Want it, but have issues? Let me know, and I'll get on that ASAP.

Note that I've removed max_length in this commit, to avoid confusion.
2020-11-16 21:09:55 +00:00
Igor Chubin
2abb75a33f
Merge pull request #131 from MFTabriz/master
add another example to ch-run
2020-11-12 21:56:31 +01:00
Igor Chubin
f058d7d647
Merge pull request #132 from MFTabriz/patch-1
add link to the issue page
2020-11-12 21:55:21 +01:00
Meisam
8a7db69085
add link to the issue page 2020-11-12 17:24:22 +01:00