I am trying to the following in a bat file, in Windows, using OpenAPI generator:
openapi-generator generate -i open-api-offline-file.json -g csharp-netcore -c open-api-config.json -o DataLakeOpenApiRestClient
REM customizing ApiClient
xcopy .\SourcesCustomizations\ApiClient.cs .\DataLakeOpenApiRestClient\src\Org.OpenAPITools\Client\ApiClient.cs* /Y /F /R
This only generates the code without running the second command (or it is run before the generation ends).
If I start the generation with start /wait:
start /wait openapi-generator generate -i open-api-offline-file.json -g csharp-netcore -c open-api-config.json -o DataLakeOpenApiRestClient
REM customizing ApiClient
xcopy .\SourcesCustomizations\ApiClient.cs .\DataLakeOpenApiRestClient\src\Org.OpenAPITools\Client\ApiClient.cs* /Y /F /R
it kind of works as expected (explicitly starts a new process and waits for it to exit).
Question: Is there a way to configure OpenAPI Generator to run synchronously?
Related
I want to create a Debian package from a C program without the use of a build tool such as autotools or CMake. My debian/rules file:
#!/usr/bin/make -f
%:
dh $#
override_dh_auto_clean:
rm -f program
override_dh_auto_build:
gcc program.c -o program
override_dh_auto_install:
cp program /usr/local/bin
Upon running dpkg-buildpackage, I get:
dh: error: Unknown sequence application (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep)
It seems the issue was related to the fact that I was creating the file in a shell script heredoc that was expanding the $#, e.g.
cat <<EOF > debian/rules.temp
#!/usr/bin/make -f
%:
dh $#
EOF
Which should be:
all_symbol='$#'
cat <<EOF > debian/rules.temp
#!/usr/bin/make -f
%:
dh $all_symbol
EOF
An unrelated issue is to the location of the override_dh_auto_install To manually create Debian file hierarchy it should be:
override_dh_auto_install:
mkdir -p debian/PACKAGENAME/usr/bin
cp program debian/PACKAGENAME/usr/bin
Or, to have this done automatically:
cat <<EOF > debian/PACKAGENAME.install
program usr/bin
EOF
I'm working on a home automation system using a Raspberry Pi. As part of this, I'd like the rPi to pull a file from my web server once a minute. I've been using rsync, but I've run into an error I can't figure out.
This command works fine when run at the command line on my rPi:
rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null" --progress username#example.com:/home/user/example.com/cmd.txt /home/pi/sprinkler/input/cmd.txt
...but when it runs in cron, it produces this error in my log:
Unexpected local arg: /home/pi/sprinkler/input/
If arg is a remote file/dir, prefix it with a colon (:).
rsync error: syntax or usage error (code 1) at main.c(1375) [Receiver=3.1.2]
...and I just answered my own question. Extensive googling around didn't turn up an answer but I just tried putting my rsync command into a bash script, and running the script in cron instead of the command and now everything works!
I'll put this here in case anyone else stumbles over this issue. Here's a script I called "sync.sh"
#!/bin/bash
# attempting a bash shell to use rsync to grab our file
rsync -avz -e "ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null"
--progress user#example.com:/home/user/example.com/vinhus/tovinhus
/cmd.txt /home/pi/sprinkler/input/
Does tcsh support launching itself in a remote directory via an argument?
The setup I am dealing with does not allow me to chdir to the remote directory before invoking tcsh, and I'd like to avoid having to create a .sh file for this workflow.
Here are the available arguments I see for v6.19:
> tcsh --help
tcsh 6.19.00 (Astron) 2015-05-21 (x86_64-unknown-Linux) options wide,nls,dl,al,kan,rh,color,filec
-b file batch mode, read and execute commands from 'file'
-c command run 'command' from next argument
-d load directory stack from '~/.cshdirs'
-Dname[=value] define environment variable `name' to `value' (DomainOS only)
-e exit on any error
-f start faster by ignoring the start-up file
-F use fork() instead of vfork() when spawning (ConvexOS only)
-i interactive, even when input is not from a terminal
-l act as a login shell, must be the only option specified
-m load the start-up file, whether or not owned by effective user
-n file no execute mode, just check syntax of the following `file'
-q accept SIGQUIT for running under a debugger
-s read commands from standard input
-t read one line from standard input
-v echo commands after history substitution
-V like -v but including commands read from the start-up file
-x echo commands immediately before execution
-X like -x but including commands read from the start-up file
--help print this message and exit
--version print the version shell variable and exit
This works, but is suboptimal because it launches two instances of tcsh:
tcsh -c 'cd /tmp && tcsh'
Is it possible to apply the same search and replace in multiple files in vim? I'll give an example below.
I have multiple .txt files — sad1.txt until sad5.txt. To open them, I'll use vim sad* and it opened already. Now inside the 5 txt files they have similar word like happy999; I would like to change it to happy111. I am currently using this code:
argdo %s/happy999/happy111/gc | wq!
Eventually only the sad1.txt is changed. What should I do to run one script in the 5 txt files?
Use:
:set aw
:argdo %s/happy999/happy111/g
The first line sets auto-write mode, so when you switch between files, vim will write the file if it has changed.
The second line does your global search and replace.
Note that it doesn't use wq! since that exits. If you don't want to use auto-write, then you could use:
:argdo %s/happy999/happy111/g | w
This avoids terminating vim at the end of editing the first file.
Also consider looking on vi and vim for answers to questions about vi and vim.
That is a task for sed -i (-i for "in place", works only with GNU sed). Yet, if you really want to use vim or you do need the /c to confirm the replace, you can do it in two ways:
With some help from the shell:
for i in sad*.txt; do
vim -c ':%s/happy999/happy111/gc' -c ':wq' "$i"
done
(the /c will still work, and vim will ask for each confirmation)
Or with pure VIM
vim -c ':%s/happy999/happy111/gc' -c ':w' -c ':n' \
-c ':%s/happy999/happy111/gc' -c ':w' -c ':n' \
-c ':%s/happy999/happy111/gc' -c ':w' -c ':n' \
-c ':%s/happy999/happy111/gc' -c ':w' -c ':n' \
-c ':%s/happy999/happy111/gc' -c ':wq' sad*.txt
(In my humble opinion this last one looks horrible and repetitive and has no real advantages over the shell for, but it shows that pure vim can do it)
No doubt, argdo is great, but to type that much boilerplate becomes quite annoying over the time.
Give a try to far.vim. It's such a tool that provide many IDEs.
If you don't need/want to be prompted for confirmation on each search and replace, use the following command, after opening your files with vim sad*:
:argdo %s/happy999/happy111/g | update
You can find more info by looking at the documentation for argdo in vim (:h argdo) or here:
http://vim.wikia.com/wiki/Search_and_replace_in_multiple_buffers
When I run urxvt -cd "/absolute/path" to start a terminal in a directory, it doesn't load my user zsh settings, it only loads the global ones in /etc.
Here's some context: Running latest stable versions of rxvt-unicode and zsh (on Arch Linux). I've got ZDOTDIR=~/.zsh in case that makes a difference (but I doubt it, since I tried symlinking ~/.zshrc to ~/.zsh/.zshrc.) If I just run urxvt then it works fine, but it's with the -cd flag that it messes up.
The reason I'm trying to do this is to start a terminal in the current location from Thunar AND have it read my user zsh configuration file. So if you know another way of doing this then that will work too.
Try adding -ls to its options to run it as login shell, like:
urxvt -ls -cd "/absolute/path"
Otherwise it will spawn a subshell. If that doesn't work for you, it still possible to use:
urxvt -e /where/is/your/zsh -i -l -c "cd /where/you/want/it"
Or (regarding the Thunar custom action):
urxvt -cd %f -e /where/is/your/zsh -i -l