Skip to content

Commit

Permalink
Update Faker & make length of lipsum (Paragraphs) configurable
Browse files Browse the repository at this point in the history
- Many new locales
- Update Alfred-Workflow
- Number of sentences per paragraph now configurable
- Add useful links to `fakeconf`
- Make keyword configurable via configuration sheet
  • Loading branch information
deanishe committed Dec 2, 2017
1 parent 86abbd6 commit a33e39c
Show file tree
Hide file tree
Showing 427 changed files with 43,232 additions and 7,543 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

# Created by https://www.gitignore.io/api/vim,python,sublimetext

*.dist-info

### Python ###
# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down
Binary file removed Fakeum-1.2.alfredworkflow
Binary file not shown.
Binary file added Fakeum-2.0.alfredworkflow
Binary file not shown.
111 changes: 79 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,42 @@
# Alfred Fakeum #
Alfred Fakeum
=============

Generate fake test data in Alfred for testing.

![][demo]

## Download ##

Get the workflow from [GitHub][gh-releases] or [Packal][packal].
Download & installation
-----------------------

## Usage ##
Download the workflow from [GitHub][gh-releases], then double-click to install.

**Note**: Files with the extension `alfred3workflow` are not compatible with Alfred 2.


Usage
-----

- `fake [<query>]` — List/filter available fake data types
- ``, `⌘+C` or `⌘+NUM` — Copy one fake datum to clipboard
- `⌘+↩` — Paste fake datum into frontmost app
- `` — Specify number of datasets to copy to clipboard
- `⌘+L` — Show generated data in Alfred's Large Text window
- `fakeconfig [<query>]` — Activate and deactivate locales for fake data
- `` — Toggle selected locale on or off

If you specify multiple data, e.g. `fake Name ⟩ 10` for 10 names, the data
will be separated by newlines (`\n`).

In the case of `Paragraph` and `Address` types, the data will be separated
by two newlines (`\n\n`).
- `fakeconfig [<query>]` — Edit workflow settings
- `An update is available` / `Check for update` — Check for and/or install an updated version of the workflow
- `Notifications` — Turn notifications on/off
- `` — Toggle on/off
- `Locales` — Turn locales for fake data on/off
- `` — Show & edit active locales
- `[<query>]` — Filter locales
- `` — Toggle locale on/off
- `Documentation` — Open GitHub README in your browser
- `Report Problem` — Open the issue tracker in your brower
- `Get Help` — Open the workflow's thread on AlfredForum.com in your browser

If you specify multiple data, e.g. `fake Name ✕ 10` for 10 names, the data will be separated by newlines (`\n`).

In the case of `Paragraph` and `Address` types, the data will be separated by two newlines (`\n\n`).

## Supported data types ##

Expand Down Expand Up @@ -68,51 +82,84 @@ by two newlines (`\n\n`).



## Supported locales ##
Supported locales
-----------------

**Note**: Not all locales support all data types.

- English
- German
- Spanish
- French
- Arabic
- Arabic (Egypt)
- Arabic (Jordan)
- Arabic (Palestine)
- Arabic (Saudi Arabia)
- Bosnian
- Bulgarian
- Chinese (China)
- Chinese (Taiwan)
- Croatian
- Czech
- German
- Danish
- Greek
- English (CA)
- English (GB)
- English (US)
- Spanish (ES)
- Spanish (MX)
- Persian
- Dutch
- Dutch (Belgium)
- English (Australia)
- English (Canada)
- English (Great Britain)
- English (Thailand)
- English (United States)
- Estonian
- Finnish
- French
- French (Switzerland)
- Georgian
- German (Austria)
- Ghanaian
- Greek
- Hebrew
- Hindi
- Hungarian
- Indonesian
- Italian
- Japanese
- Korean
- Lithuanian
- Latin
- Latvian
- Dutch
- Lithuanian
- Nepali
- Norwegian
- Persian
- Polish
- Portuguese (BR)
- Portuguese (Brazil)
- Portuguese (Portugal)
- Russian
- Slovakian
- Slovenian
- Chinese (CN)
- Chinese (TW)
- Spanish (Mexico)
- Spanish (Spain)
- Swedish
- Thai
- Turkish
- Ukranian


## Licensing, thanks ##
Licensing, thanks
-----------------

Icons are from [Font Awesome][font-awesome] ([SIL OFL 1.1 Licence][sil]).
Icons are from [Font Awesome][font-awesome] and [Material Design Iconic Font](material-icons) (both [SIL OFL 1.1 Licence][sil]).

Alfred Fakum uses the following libraries:

- [Faker][faker] ([licence][faker-licence])
- [Faker][faker] ([MIT Licence][faker-licence])
- [docopt][docopt] ([MIT Licence][mit])
- [Alfred-Workflow][alfred-workflow] ([MIT Licence][mit])

[gh-releases]: https://github.com/deanishe/alfred-fakeum/releases
[packal]: http://www.packal.org/workflow/fakeum
[gh-releases]: https://github.com/deanishe/alfred-fakeum/releases/latest
[mit]: http://opensource.org/licenses/MIT
[alfred-workflow]: http://www.deanishe.net/alfred-workflow/
[font-awesome]: http://fortawesome.github.io/Font-Awesome/
[material-icons]: http://zavoloklom.github.io/material-design-iconic-font/
[docopt]: http://docopt.org/
[faker]: http://www.joke2k.net/faker/
[faker-licence]: https://github.com/joke2k/faker/blob/master/LICENSE.txt
Expand Down
37 changes: 37 additions & 0 deletions bin/example-data
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2014 [email protected]
#
# MIT Licence. See http://opensource.org/licenses/MIT
#
# Created on 2014-12-29
#

"""Print sample fake data to STDOUT."""

from __future__ import print_function, absolute_import

import sys
import os

sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/../src/libs'))
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__) + '/../src'))


def main():
"""Print sample fake data."""
from workflow import Workflow
import fakeum

wf = Workflow()
fakeum.wf = wf
print('| Name | Example |')
print('|-- |--|')
for name in fakeum.FAKERS:
ex = fakeum.get_fake_datum(name)
print(u'| {} | {} |'.format(name, ex).encode('utf-8'))


if __name__ == '__main__':
sys.exit(main())
137 changes: 137 additions & 0 deletions bin/icons
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
#!/usr/bin/env zsh

set -e

# URL of icon generator
api="http://icons.deanishe.net/icon"
here="$( cd "$( dirname "$0" )"; pwd )"
root="$( cd "$here/../"; pwd )"
# where workflow icons belong
icondir="${root}/src/icons"
# icon config file
iconfile="${root}/icons.txt"

prog="$( basename "$0" )"

force=false
verbose=false
vopt=
icons=()

# log <arg>... | Echo arguments to STDERR
log() {
echo "$@" >&2
}

# info <arg>.. | Write args to STDERR if VERBOSE is true
info() {
$verbose && log $(print -P "%F{blue}..%f") "$@"
return 0
}

# success <arg>.. | Write green "ok" and args to STDERR if VERBOSE is true
success() {
$verbose && log $(print -P "%F{green}ok%f") "$@"
return 0
}

# error <arg>.. | Write red "error" and args to STDERR
error() {
log $(print -P '%F{red}error%f') "$@"
}

# fail <arg>.. | Write red "error" and args to STDERR, then exit with status 1
fail() {
error "$@"
exit 1
}

# load | Read configuration file from STDIN
load() {
typeset -g icons
while read line; do

# ignore lines that start with # or are empty
[[ $line =~ "#" ]] || test -z "$line" && continue

read fname font colour name <<< "$line"
icons+=($fname $font $colour $name)

done
}

usage() {
cat <<EOF
$prog [options]
Download icons from server.
Usage:
$prog [-v] [-f]
$prog -h
Options:
-f Force re-download
-h Show this help message and exit
-v Be verbose
EOF
}

while getopts ":fhv" opt; do
case $opt in
f)
force=true;;
h)
usage
exit 0;;
v)
verbose=true
vopt='-v'
;;
\?)
fail "invalid option: -$OPTARG";;
esac
done
shift $((OPTIND-1))


cat "$iconfile" | load

success "loaded config from $iconfile"

total=$(( ${#icons} / 4 ))
fetched=0
j=0
for (( i=1; i<${#icons}; i=i+4 )); do
j=$(( j + 1 ))

fname=$icons[$i]
font=$icons[$i+1]
colour=$icons[$i+2]
name=$icons[$i+3]

# info "j=$j, name=$name, font=$font, fname=$fname"

url="${api}/${font}/${colour}/${name}"
n="${fname}.png"
p="$icondir/$n"
pc="[$j/$total]"

# download source icon
copts=(-L)
$verbose && copts+=(-#) || copts+=(-sS)
$force || ! test -s "$p" && {
curl $copts -o "$p" "$url"
[[ $? -ne 0 ]] && fail "couldn't download $n"
success "downloaded $n"
fetched=$(( fetched + 1 ))
} || {
info "skipped existing $n"
}

done

verbose=true
success "downloaded $fetched icon(s)"

exit 0
Loading

0 comments on commit a33e39c

Please sign in to comment.