I'm running the command:
babel -x jsx -d app/built/ app/emails/*.jsx
It's transpiling app/emails/*.jsx to app/built/app/emails/*.js
Does Babel have a parameter that would directly transpile to app/built/*.js? i.e. to trim the app/emails/ part of the output file?
For my use case, flattening would be acceptable, but really, the trim would be most useful (so that hierarchy below app/emails is maintained.
There is not an option for this. The filepath is just joined with the output folder. The best way to do this would be
cd app/emails && babel -x jsx -d ../built *.jsx
Related
I'm trying to learn how autocompletion works in zsh. I've got a simple script file (example.zsh) and I'm trying to create a simple autocomplete function that describes each of its parameters. In order to do that, I've started by creating a simple _example file which looks like this:
#compdef create_ca
_arguments \
"--caKey[name of the file that will hold the keys used for generating the certificate (default: ca.key)]" \
"--caCrt[name of the file that will hold the certificate with the public key (default: ca.crt)]" \
"--cn[common name for the root certificate (default: root.GRM)]" \
"--days[number of days that certificate is valid for (default: 10500)]" \
"--size[key size (default: 4096)]" \
"--help[show this help screen]"
The file is on the same folder as the script and I've updated my .zshrc file so that it adds that folder to the $fpath:
fpath=(~/code/linux_certificates $fpath)
autoload -Uz compinit
compinit -D
I'm using the D option so that the .zcompdump isn't generated. At first sight, everything worked out, but when I tried to update the helper autocomplete function, I'm unable to see thosee changes (ex.: changing the description). I've tried re-running the compinit command and, when using the cache .zcompdump, deleting that file. However, it simply didn't work. The only way I've managed to get it working was by deleting the autocomplete helper function with:
unfunction _create_ca
Is this the expected behavior? I mean, should't running compinit -D be enough to reload my helper autocomplete function?
btw, any good tutorials on how to create autocomplete functions (besides the official docs)?
thanks.
Once a function has been loaded, it will not be loaded again. That’s why you first have to unfunction your function, causing Zsh to unload it, so it can be loaded again.
Alternatively, you can just use exec zsh to restart your shell.
I may have missed this detail but I'm trying to see if I can control the set of plugins made available through the ini configuration itself.
I did not find that item enumerated in any of the configurable command-line options nor in any of the documentation around the pytest_plugins global.
The goal is to reuse a given test module with different fixture implementations.
#hoefling is absolutely right, there is actually a pytest command line argument that can specify plugins to be used, which along with the addopts ini configuration can be used to select a set of plugin files, one per -p command.
As an example the following ini file selects three separate plugins, the plugins specified later in the list take precedence over those that came earlier.
projX.ini
addopts =
-p projX.plugins.plugin_1
-p projX.plugins.plugin_2
-p projY.plugins.plugin_1
We can then invoke this combination on a test module with a command like
python -m pytest projX -c projX.ini
A full experiment is detailed here in this repository
https://github.com/jxramos/pytest_behavior/tree/main/ini_plugin_selection
I am trying to extract metadata for package component files using Tika at the command line, but I can only seem to get it to output metadata for the containing package file. Example: test_file.zip contains two files, test1.doc and test2.doc. I want to get the metadata for test1.doc and test2.doc, but cannot figure out how to do so.
I tried to run this:
java -jar tika-app-1.5.jar -m test_files.zip
but that just outputted the Content-Length, Content-Type, and resourceName for test_files.zip.
I also tried to run this:
java -jar tika-app-1.5.jar -h test_files.zip
That outputted the HTML for each component file, wrapped in a <div> with class ."package-entry", but the metadata tags were again outputted only for the containing package file test_files.zip. I tried using the -x parameter instead of -h, and no parameter at all, and got exactly the same result.
How do I get the metadata for the component files? I don't mind parsing the embedded metadata from xhtml but I cannot figure how to get it injected into the xhtml or otherwise outputted.
Any help much appreciated. Thank you.
Since you've said you want to do it with only the tika-app jar, your best option is something like
# Create a temp directory
cd /tmp
mkdir tika-extracted
cd tika-extracted
# Have Tika extract out all the embedded resources
java -jar tika-app-1.5.jar --extract $INPUT
# Process each one in turn
for e in *; do
java -jar tika-app-1.5.jar --metadata $e
done
# Tidy up
cd /tmp
rm -rf tika-extracted
Using Java, you'd be able to register your own EmbeddedDocumentExtractor on the ParserContext, and use that to trigger the metadata extraction for each one individually
After installing perl you can find a Config_heavy.pl file e.g. in /usr/lib/perl5/5.18/mach/Config_heavy.pl and I wonder if there is a commentation of all key/value pairs one can find in it. The of them are clear, but sometimes I'm not sure.
Calling perl -V shows all these values in there.
I guess what I really want to know is, which values are really 'hard', because not only in this file so a change would have no effect, an which have an effect after change? E.g. which can I change to have an effect in CPAN like adding a '-I.' to the ccflags to have CPAN searching for local headers included with <> instead of "" (you can find this in Authen::PAM ;) ).
So if there is some more information do find about the keys in this file, I would be happy to learn about them.
From the command line,
perldoc Config
You shouldn't change that file.
I think the following will do the trick to install Authen::PAM:
wget http://search.cpan.org/CPAN/authors/id/N/NI/NIKIP/Authen-PAM-0.16.tar.gz
tar xvzf Authen-PAM-0.16.tar.gz
cd Authen-PAM-0.16
perl Makefile.PL CCFLAGS='-I.'
make test
make install
I'm trying to write a simple Autotool package that just packages a single script. This might seem like overkill, but the script is to be added into the build-system for an embedded system and the build-system is designed to play nicely with Autotools.
I have a shell-script called wifi_query.sh. To package this I've followed the following steps:
Created Makefile.am which contains the following -
bin_SCRIPTS = wifi_query.sh
CLEANFILES = $(bin_SCRIPTS)
I also created wifi_query.sh.in which contains the line exec wifi_query.sh. I'm not sure I understand the purpose of the .in file.
I then run autoscan.
Then I run:
sed -e 's/FULL-PACKAGE-NAME/wifi_query/' \
-e 's/VERSION/1/' \
-e 's|BUG-REPORT-ADDRESS|/dev/null|' \
-e '10i\
AM_INIT_AUTOMAKE' \
< configure.scan > configure.ac
Run touch NEWS README AUTHORS ChangeLog.
Run autoreconf -iv
./configure
make distcheck
When I run make distcheck I get an error saying: "* No rule to make target 'wifi_query.sh', needed by 'all-am'. Stop.".
I don't understand this error, if anyone could give me any pointers that would be good. My suspicion is that the error may be due to wifi_query.sh.in, but I have very limited autotools experience.
It seems I needed to replace the line bin_SCRIPTS = wifi_query.sh with dist_bin_SCRIPTS = wifi_query.sh in Makefile.am. Having done that everything seems to work.