Boteye_sensor/astyle_ At Master - GitHub

Skip to content Dismiss alert {{ message }} / boteye_sensor Public
  • Notifications You must be signed in to change notification settings
  • Fork 35
  • Star 35
  • Code
  • Issues 10
  • Pull requests
  • Actions
  • Projects
  • Security
  • Insights
Additional navigation options

Files

 master

Breadcrumbs

  1. boteye_sensor
  2. firmware
  3. utils
astyle_google.shBlameBlame

Latest commit

 

History

Historyexecutable file·54 lines (51 loc) · 1.88 KB master
  1. boteye_sensor
  2. firmware
  3. utils
astyle_google.shTop

File metadata and controls

  • Code
  • Blame
executable file·54 lines (51 loc) · 1.88 KBRaw123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354#!/bin/bash# This script is a wrapper on top of AStyle to beautify the code to comply# with Google coding style (as close as possible).## If the source_path is a file, AStyle it.# If the source_path is a directory, AStyle selected file types (.h, .hpp, .cc, .cpp)# in source_path recursrively. Use with CAUTION!!!if [ $# -ne 1 ]; then echo " Usage:" echo " (single file): astyle_google.sh /project/path/filename" echo " (recursive on .h/.hpp/.cc/.cpp) : astyle_google.sh /project/path" exitfisource_path=$1 # Locate AStyle binary#astyle_bin=~/Development/astyle/build/mac/bin/AStyleastyle_bin=/usr/bin/astyleif [[ ! -f ${astyle_bin} ]]; then echo "${astyle_bin} doesn't exist!" echo " Download AStyle @ http://astyle.sourceforge.net" exitfi # AStyle options to comply with our desired google c++ coding style# Check http://astyle.sourceforge.net/astyle.html for details of these optionsstyle_options="--style=google \ --indent=spaces=2 \ --break-after-logical \ --indent-modifiers \ --suffix=none \ --keep-one-line-blocks \ --keep-one-line-statements \ --pad-header \ --pad-oper \ --pad-comma \ --convert-tabs" # --max-continuation-indent=100" # --max-code-length=100 \ if [[ -d ${source_path} ]]; then # Find files whose names matches the regex pattern(s) # The --recursive seems not workgin properly on OSX, # so we use the old-school way to find each file and AStyle it files=`find -E ${source_path} -regex '.*\.(cpp|cc|hpp|h)' -print0 | xargs -0` for file in $files do ${astyle_bin} ${style_options} $file doneelif [[ -f ${source_path} ]]; then ${astyle_bin} ${style_options} ${source_path}else echo "invalid ${source_path}"fi You can’t perform that action at this time.

Từ khóa » .cc .cpp