• Stars
    star
    152
  • Rank 244,685 (Top 5 %)
  • Language
  • License
    MIT License
  • Created over 14 years ago
  • Updated over 12 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Automator services for Xcode 4 that allow you quickly reformat your code using the brilliant uncrustify utility

Uncrustify Automator Services for Xcode 4

  • Author: Tony Arnold, [email protected]
  • Requirements: Xcode 4 or higher, Mac OS X 10.6 or higher

What's it do?

These automator scripts allow you quickly reformat your Objective-C code using the brilliant uncrustify command-line utility (http://uncrustify.sf.net/).

A sample Objective-C uncrustify configuration file is available at http://gist.github.com/261662/ - just copy or move this file to ~/.uncrustify.cfg to use it.

Installation

I will assume you have a basic understanding of installing software using a package manager like Homebrew.

  1. Install uncrustify. I use Homebrew to do this β€” brew install uncrustify β€” but you could just as easily do it by hand, or ;
  2. Make sure that uncrustify is in your $PATH β€” you can verify this by opening a new terminal window and typing which uncrustify β€” if the full path to your copy of uncrustify is printed, you're set;
  3. Copy or move the included workflow files into ~/Library/Services/.
  4. Open the "Uncrustify Document" using Automator, and update the line beginning with set formatted_source in the "Run AppleScript" block to reflect the path to your copy of uncrustify. It should look something like: set formatted_source to do shell script "/usr/local/bin/uncrustify -c ~/.uncrustify.cfg -l OC -f " & quoted form of current_document_path
  5. Do the same for the "Uncrustify Document and Re-Indent" automator workflow
  6. Open the "Uncrustify Selected Source Code.workflow" documents in Automator, and update the "Run Shell Script" block to reflect the path to your copy of uncrustify. It should look something like: /usr/local/bin/uncrustify --frag -c ~/.uncrustify.cfg -l OC | cat

How do I use it?

A word of caution

Uncrustify will write over your source files with it's changes without asking you if you choose to operate on an entire document. If you want to see what changes will be made without writing over your files, select all the code in your current Objective-C file and use the "Uncrustify Selected Source Code" service.

The "Uncrustify Selected Source Code" will only work with Objective-C documents due to the presence of the -l OC argument in the workflow script.

The "Uncrustify Document" service will first save any changes you've made to the frontmost source document, and then run it through uncrustify. It will also only work with Objective-C source code documents.

The "Uncrustify Document and Re-Indent" service will first do the same thing as the "Uncrustify Document" service, but will then use Xcode's own "Re-Indent" function, which should mean that your final document format's indenting will match Xcode's editing style. It will also only work with Objective-C source code documents.

How to

  1. Open a document (or multiple documents), or select text in an already open document;
  2. Go to the Xcode menu, then select Services and make your choice from the scripts starting with "Uncrustify...".

Your file's contents will be updated immediately.

Copyright

Copyright 2010β€”2011 Tony Arnold. See LICENSE for details.

More Repositories

1

virtuedesktops

Discontinued virtual desktop manager for Apple’s Mac OS X 10.4 "Tiger".
Objective-C
16
star
2

resourceror

Command-line tool to generate Swift static variables for images, XIBs, Storyboards and their contents
Swift
15
star
3

XcodeSwiftFormatter

An Xcode Source Editor Extension that formats Swift code using swift-format
Swift
13
star
4

energon

Random Cocoa and Objective-C from The CocoaBots
Objective-C
11
star
5

CoverStory

Objective-C
5
star
6

symphony-ckeditor

Symphony CMS extension that provides the CKEditor WYSIWYG editor for text fields.
PHP
5
star
7

sample-iphonesdk-tapthatmap

A sample iPhone SDK project demonstrating how to stop following a user's location on user touches.
Objective-C
5
star
8

XcodeThemes

4
star
9

tonyarnold.github.io

My personal site
SCSS
4
star
10

typography_text_formatters

Symphony CMS extension that provides PHP Typography formatting for text fields.
PHP
4
star
11

symphony-signedfileuploadfield

Symphony CMS extension that generates DSA signatures for uploaded files.
PHP
4
star
12

epiceditor

EpicEditor extension for Symphony CMS
JavaScript
3
star
13

DiffPerformanceSuite

Simple performance testing of common Swift-based diff libraries
Swift
2
star
14

swift-openapi-foundation

Foundation transport for Swift OpenAPI Generator.
Swift
2
star
15

CocoaBotsXcodeTemplates

Xcode templates used by The Cocoabots. These templates include boilerplate code that makes bringing up classes faster.
Objective-C
2
star
16

XcodeSourceEditorExtensionTemplate

Xcode project that can be used a template for building Xcode Source Editor Extensions
Swift
1
star
17

dotfiles

Vim Script
1
star
18

Configuration

1
star
19

symphony_3_admin_style

This extension contains a backported admin stylesheet from Symphony 3, as per the discussion at http://symphony-cms.com/discuss/thread/50733/.
PHP
1
star
20

symphony-typogrify

Symphony CMS extension that provides Typogrify text formatters for text fields. This extension is deprecated - please use the "symphony-typography" extension instead.
PHP
1
star