diff --git a/org/config/bin.org b/org/config/bin.org index 8802d30..1ddfdb3 100644 --- a/org/config/bin.org +++ b/org/config/bin.org @@ -166,128 +166,6 @@ governor=$(printf "%s\n" "${governors[@]}" | rofi -dmenu) sudo -A cpupower frequency-set -g "$governor" #+end_src -** Development -:PROPERTIES: -:CUSTOM_ID: cli-utilities-Development-baec808a -:END: -*** Cppnew :noexport: -:PROPERTIES: -:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :tangle no -:CUSTOM_ID: Cppnew-964e697b -:END: -=cppnew= is a small utility that helps you create a new C++ project. Several -templates are available, the default one using CMake, and three others that are -a bit more advances, based on: -- CMake + [[https://conan.io/][Conan]] -- [[https://mesonbuild.com/][Meson]] + [[https://ninja-build.org/][Ninja]] -- Meson + Ninja + Conan -There is also a default [[http://doxygen.nl/][Doxygen]] file included for your documentation, ready to -go. I even made it so that you can execute it as an executable file, like -=./doc/Doxyfile= from the project root. - -The choice is given to the user which of them to use with options that will be -given to =cppnew=. - -First, if no arguments were passed, return an error. -#+begin_src fish -if ! count $argv >/dev/null - echo "Missing argument: PROJECT" && return -1 -end -#+end_src - -Now, let’s set a couple of variables which will prove useful later on when -trying to set up our project. - -*** Cnew -:PROPERTIES: -:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/cnew -:CUSTOM_ID: Cnew-d9ec9cc4 -:END: -=cnew= is a small utility script similar to but simpler than cppnew that creates -a CMake template C project from the template that already exists in -[[file:~/dev/templateC][~/dev/templateC]]. If no argument was passed, display an error message and exit. -#+BEGIN_SRC fish -if ! count $argv > /dev/null - echo "Missing argument: PROJECT" && return -1 -end -#+END_SRC - -Pass the first argument to a switch statement. -#+BEGIN_SRC fish -switch "$argv[1]" -#+END_SRC - -If the argument is =-h= or =--help=, then display the help message and exit the -script normally. -#+BEGIN_SRC fish -case -h --help - man ~/dev/fishfunctions/cnew.man - exit 0 -#+END_SRC - -Else, the argument is the name of the project the user wants to create. -#+BEGIN_SRC fish -case '*' - set -g project_name $argv[1] -#+END_SRC - -Let’s close the switch statement. -#+BEGIN_SRC fish -end -#+END_SRC - -Now, let’s copy the template where the user is executing =cnew= from, give it -the name of the project and move to the project. -#+BEGIN_SRC fish -cp -r ~/dev/templateC $argv[1] -cd $argv[1] -#+END_SRC - -The default files have a placeholder for the name of the project. Let’s replace -these placeholders with the project’s name. -#+BEGIN_SRC fish -sed -i "s/PROJECTNAME/$argv[1]/g" CMakeLists.txt -sed -i "s/PROJECTNAME/$argv[1]/g" README.org -sed -i "s/CPROJECTNAME/$argv[1]/g" doc/Doxyfile -#+END_SRC - -Now, let’s create a git repository and initialize it. -#+BEGIN_SRC fish -git init -git add . -git commit -m "initial commit" -#+END_SRC - -And we’re done! - -*** Dart Language Server -:PROPERTIES: -:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dart_language_server -:CUSTOM_ID: Dart_Language_Server-18c256b1 -:END: -Spacemacs' recommendations on how to use Dart with LSP is outdated, since -[[https://github.com/natebosch/dart_language_server][=dart_language_server=]] is obsolete. As recommended by the repo owner, we should -launch instead the following code: -#+BEGIN_SRC fish -/usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp -#+END_SRC - -So, instead of using the obsolete executable, instead we will be calling the -analysis server as requested. - -*** UpdateFlutter -:PROPERTIES: -:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/UpdateFlutter -:CUSTOM_ID: UpdateFlutter-1e8fbeb7 -:END: -This is a simple utility to run when the ~flutter~ package is updated. -#+BEGIN_SRC fish -sudo chown -R :flutterusers /opt/flutter -sudo chmod -R g+w /opt/flutter -sudo chmod a+rw /opt/flutter/version -sudo chown $USER:(id -g $USER) /opt/flutter/bin/cache -#+END_SRC - ** docker-running :PROPERTIES: :CUSTOM_ID: cliutilitiesdockerrunning-awb2jbx09rj0