mirror of
https://github.com/tldr-pages/tldr.git
synced 2025-04-22 05:42:09 +02:00
refactors index building script to output JSON
also removes index.md
This commit is contained in:
parent
21cb9ac9e1
commit
e24d9800a8
4 changed files with 27 additions and 190 deletions
2
Makefile
2
Makefile
|
@ -1,3 +1,3 @@
|
||||||
index:
|
index:
|
||||||
ls -d1 ./pages/**/* | grep .md | awk -F"." '{print $$2}' | awk -F"/" '{print $$4,$$3}' | sort > pages/index.md
|
@TLDRHOME=`pwd` ./scripts/build_index.rb
|
||||||
@echo "Index rebuilt."
|
@echo "Index rebuilt."
|
||||||
|
|
1
pages/index.json
Normal file
1
pages/index.json
Normal file
File diff suppressed because one or more lines are too long
189
pages/index.md
189
pages/index.md
|
@ -1,189 +0,0 @@
|
||||||
ab common
|
|
||||||
ack common
|
|
||||||
ag common
|
|
||||||
airport osx
|
|
||||||
alias common
|
|
||||||
apropos common
|
|
||||||
apt-get linux
|
|
||||||
aptitude linux
|
|
||||||
ar common
|
|
||||||
awk common
|
|
||||||
base64 linux
|
|
||||||
brew osx
|
|
||||||
bundle common
|
|
||||||
caffeinate osx
|
|
||||||
cal common
|
|
||||||
cat common
|
|
||||||
cd common
|
|
||||||
chmod common
|
|
||||||
chown common
|
|
||||||
chsh common
|
|
||||||
cksum common
|
|
||||||
convert common
|
|
||||||
cp common
|
|
||||||
curl common
|
|
||||||
cut common
|
|
||||||
date common
|
|
||||||
deluser common
|
|
||||||
df common
|
|
||||||
diff common
|
|
||||||
dig common
|
|
||||||
diskutil osx
|
|
||||||
dpkg linux
|
|
||||||
drutil osx
|
|
||||||
du linux
|
|
||||||
du osx
|
|
||||||
echo common
|
|
||||||
electrum common
|
|
||||||
emerge linux
|
|
||||||
env common
|
|
||||||
exiftool common
|
|
||||||
fdupes common
|
|
||||||
ffmpeg common
|
|
||||||
find common
|
|
||||||
findmnt linux
|
|
||||||
firewall-cmd linux
|
|
||||||
free linux
|
|
||||||
fswebcam common
|
|
||||||
gcc common
|
|
||||||
gem common
|
|
||||||
gifsicle common
|
|
||||||
git common
|
|
||||||
git-add common
|
|
||||||
git-branch common
|
|
||||||
git-checkout common
|
|
||||||
git-clone common
|
|
||||||
git-commit common
|
|
||||||
git-diff common
|
|
||||||
git-init common
|
|
||||||
git-log common
|
|
||||||
git-merge common
|
|
||||||
git-push common
|
|
||||||
git-stash common
|
|
||||||
git-status common
|
|
||||||
gpg common
|
|
||||||
grep common
|
|
||||||
gzip common
|
|
||||||
handbrakecli common
|
|
||||||
haxelib common
|
|
||||||
head linux
|
|
||||||
head osx
|
|
||||||
iconv common
|
|
||||||
iostat linux
|
|
||||||
ip linux
|
|
||||||
ipcs common
|
|
||||||
journalctl linux
|
|
||||||
kill common
|
|
||||||
less common
|
|
||||||
ln common
|
|
||||||
locate linux
|
|
||||||
locate osx
|
|
||||||
ls common
|
|
||||||
lsof common
|
|
||||||
man common
|
|
||||||
md5 osx
|
|
||||||
md5sum linux
|
|
||||||
mdadm linux
|
|
||||||
mkdir common
|
|
||||||
more common
|
|
||||||
mount common
|
|
||||||
mp4box common
|
|
||||||
mtr common
|
|
||||||
mv common
|
|
||||||
mysql common
|
|
||||||
mysqldump common
|
|
||||||
nc common
|
|
||||||
netstat linux
|
|
||||||
networksetup osx
|
|
||||||
nmap common
|
|
||||||
node common
|
|
||||||
nohup common
|
|
||||||
npm common
|
|
||||||
open osx
|
|
||||||
pacman linux
|
|
||||||
passwd common
|
|
||||||
patch common
|
|
||||||
pbcopy osx
|
|
||||||
pbpaste osx
|
|
||||||
pgrep common
|
|
||||||
php common
|
|
||||||
ping common
|
|
||||||
pip common
|
|
||||||
play common
|
|
||||||
prctl sunos
|
|
||||||
prstat sunos
|
|
||||||
ps common
|
|
||||||
psql common
|
|
||||||
pushd common
|
|
||||||
pwd common
|
|
||||||
qlmanage osx
|
|
||||||
redis-cli common
|
|
||||||
rename common
|
|
||||||
rm common
|
|
||||||
rmdir common
|
|
||||||
route osx
|
|
||||||
rsync common
|
|
||||||
salt-call common
|
|
||||||
salt-key common
|
|
||||||
say osx
|
|
||||||
scp common
|
|
||||||
screen common
|
|
||||||
sed common
|
|
||||||
sha1sum linux
|
|
||||||
sha224sum linux
|
|
||||||
sha256sum linux
|
|
||||||
sha384sum linux
|
|
||||||
sha512sum linux
|
|
||||||
shuf linux
|
|
||||||
shutdown linux
|
|
||||||
shutdown osx
|
|
||||||
sort common
|
|
||||||
sox common
|
|
||||||
split common
|
|
||||||
srm common
|
|
||||||
ss linux
|
|
||||||
ssh common
|
|
||||||
sshfs common
|
|
||||||
sudo common
|
|
||||||
svcadm sunos
|
|
||||||
svccfg sunos
|
|
||||||
svcs sunos
|
|
||||||
svn common
|
|
||||||
sw_vers osx
|
|
||||||
sysctl osx
|
|
||||||
system_profiler osx
|
|
||||||
systemctl linux
|
|
||||||
systemsetup osx
|
|
||||||
tail common
|
|
||||||
tar common
|
|
||||||
tcpdump common
|
|
||||||
tcpflow linux
|
|
||||||
tee common
|
|
||||||
telnet common
|
|
||||||
time common
|
|
||||||
tldr common
|
|
||||||
tmux common
|
|
||||||
touch common
|
|
||||||
traceroute common
|
|
||||||
tree common
|
|
||||||
umount common
|
|
||||||
uname common
|
|
||||||
unzip common
|
|
||||||
useradd common
|
|
||||||
userdel common
|
|
||||||
userdel linux
|
|
||||||
usermod common
|
|
||||||
wacaw osx
|
|
||||||
wall linux
|
|
||||||
watch linux
|
|
||||||
wc common
|
|
||||||
wget common
|
|
||||||
which common
|
|
||||||
wpa_cli linux
|
|
||||||
xargs linux
|
|
||||||
xed osx
|
|
||||||
xsltproc osx
|
|
||||||
yes common
|
|
||||||
zfs common
|
|
||||||
zip common
|
|
||||||
zpool common
|
|
25
scripts/build_index.rb
Executable file
25
scripts/build_index.rb
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require "json"
|
||||||
|
|
||||||
|
commands = {}
|
||||||
|
|
||||||
|
Dir["#{ENV["TLDRHOME"]}/pages/**/*.md"].each do |file|
|
||||||
|
# "./pages/osx/xsltproc.md",
|
||||||
|
file = file.split("/")
|
||||||
|
name = file.pop().gsub(".md","")
|
||||||
|
platform = file.pop()
|
||||||
|
|
||||||
|
unless commands.key?(name)
|
||||||
|
commands[name] = {
|
||||||
|
name: name,
|
||||||
|
platform: [platform]
|
||||||
|
}
|
||||||
|
else
|
||||||
|
commands[name][:platform] << platform
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
commands = commands.map do |k,v| v end
|
||||||
|
|
||||||
|
File.write("#{ENV["TLDRHOME"]}/pages/index.json", {commands: commands}.to_json)
|
Loading…
Add table
Reference in a new issue