-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Closes #91. Add configuration option for custom Uncrustify path
- Loading branch information
Showing
5 changed files
with
40 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,38 @@ | ||
### | ||
Requires http://pear.php.net/package/PHP_Beautifier | ||
Requires http://uncrustify.sourceforge.net/ | ||
### | ||
"use strict" | ||
cliBeautify = require("../cli-beautify") | ||
cfg = require("./cfg") | ||
path = require("path") | ||
getCmd = (inputPath, outputPath, options, cb) -> | ||
|
||
uncrustifyPath = options.uncrustifyPath | ||
# console.log('Uncrustify options:', options); | ||
# console.log("Uncrustify path: #{uncrustifyPath}") | ||
# Complete callback | ||
done = (configPath) -> | ||
|
||
# console.log(configPath); | ||
if pathToCommand | ||
|
||
if uncrustifyPath | ||
# Use path given by user | ||
cmd = pathToCommand + " -c \"" + configPath + "\" -f \"" + inputPath + "\" -o \"" + outputPath + "\" -l \"" + lang + "\"" | ||
cmd = "#{uncrustifyPath} -c \"#{configPath}\" -f \"#{inputPath}\" -o \"#{outputPath}\" -l \"#{lang}\"" | ||
else | ||
|
||
# Use command available in $PATH | ||
cmd = "uncrustify -c \"" + configPath + "\" -f \"" + inputPath + "\" -o \"" + outputPath + "\" -l \"" + lang + "\"" | ||
cmd = "uncrustify -c \"#{configPath}\" -f \"#{inputPath}\" -o \"#{outputPath}\" -l \"#{lang}\"" | ||
# console.log(cmd); | ||
cb cmd | ||
configPath = options.configPath | ||
lang = options.languageOverride or "C" | ||
pathToCommand = atom.config.get("atom-beautify.uncrustifyPath") | ||
# console.log(pathToCommand) | ||
lang = options.languageOverride or "C" # Default is C | ||
unless configPath | ||
|
||
# No custom config path | ||
cfg options, (error, path) -> | ||
cfg options, (error, cPath) -> | ||
throw error if error | ||
done path | ||
|
||
done cPath | ||
else | ||
|
||
# Has custom config path | ||
editor = atom.workspace.getActiveEditor() | ||
basePath = path.dirname(editor.getPath()) | ||
|
||
# console.log(basePath); | ||
configPath = path.resolve(basePath, configPath) | ||
done configPath | ||
return | ||
"use strict" | ||
cliBeautify = require("../cli-beautify") | ||
cfg = require("./cfg") | ||
path = require("path") | ||
module.exports = cliBeautify(getCmd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
["newlines","input_tab_size","output_tab_size","string_escape_char","string_escape_char2","tok_split_gte","utf8_bom","utf8_byte","utf8_force","indent_columns","indent_continue","indent_with_tabs","indent_cmt_with_tabs","indent_align_string","indent_xml_string","indent_brace","indent_braces","indent_braces_no_func","indent_braces_no_class","indent_braces_no_struct","indent_brace_parent","indent_namespace","indent_namespace_level","indent_namespace_limit","indent_extern","indent_class","indent_class_colon","indent_ctor_init_leading","indent_ctor_init","indent_else_if","indent_var_def_blk","indent_var_def_cont","indent_func_def_force_col1","indent_func_call_param","indent_func_def_param","indent_func_proto_param","indent_func_class_param","indent_func_ctor_var_param","indent_template_param","indent_func_param_double","indent_func_const","indent_func_throw","indent_member","indent_sing_line_comments","indent_relative_single_line_comments","indent_switch_case","indent_case_shift","indent_case_brace","indent_col1_comment","indent_label","indent_access_spec","indent_access_spec_body","indent_paren_nl","indent_paren_close","indent_comma_paren","indent_bool_paren","indent_first_bool_expr","indent_square_nl","indent_preserve_sql","indent_align_assign","indent_oc_block","indent_oc_block_msg","indent_oc_msg_colon","sp_arith","sp_assign","sp_cpp_lambda_assign","sp_cpp_lambda_paren","sp_assign_default","sp_before_assign","sp_after_assign","sp_enum_assign","sp_enum_before_assign","sp_enum_after_assign","sp_pp_concat","sp_pp_stringify","sp_before_pp_stringify","sp_bool","sp_compare","sp_inside_paren","sp_paren_paren","sp_balance_nested_parens","sp_paren_brace","sp_before_ptr_star","sp_before_unnamed_ptr_star","sp_between_ptr_star","sp_after_ptr_star","sp_after_ptr_star_func","sp_ptr_star_paren","sp_before_ptr_star_func","sp_before_byref","sp_before_unnamed_byref","sp_after_byref","sp_after_byref_func","sp_before_byref_func","sp_after_type","sp_before_template_paren","sp_template_angle","sp_before_angle","sp_inside_angle","sp_after_angle","sp_angle_paren","sp_angle_word","sp_angle_shift","sp_permit_cpp11_shift","sp_before_sparen","sp_inside_sparen","sp_inside_sparen_close","sp_inside_sparen_open","sp_after_sparen","sp_sparen_brace","sp_invariant_paren","sp_after_invariant_paren","sp_special_semi","sp_before_semi","sp_before_semi_for","sp_before_semi_for_empty","sp_after_semi","sp_after_semi_for","sp_after_semi_for_empty","sp_before_square","sp_before_squares","sp_inside_square","sp_after_comma","sp_before_comma","sp_paren_comma","sp_before_ellipsis","sp_after_class_colon","sp_before_class_colon","sp_before_case_colon","sp_after_operator","sp_after_operator_sym","sp_after_cast","sp_inside_paren_cast","sp_cpp_cast_paren","sp_sizeof_paren","sp_after_tag","sp_inside_braces_enum","sp_inside_braces_struct","sp_inside_braces","sp_inside_braces_empty","sp_type_func","sp_func_proto_paren","sp_func_def_paren","sp_inside_fparens","sp_inside_fparen","sp_inside_tparen","sp_after_tparen_close","sp_square_fparen","sp_fparen_brace","sp_func_call_paren","sp_func_call_paren_empty","sp_func_call_user_paren","sp_func_class_paren","sp_return_paren","sp_attribute_paren","sp_defined_paren","sp_throw_paren","sp_after_throw","sp_catch_paren","sp_version_paren","sp_scope_paren","sp_macro","sp_macro_func","sp_else_brace","sp_brace_else","sp_brace_typedef","sp_catch_brace","sp_brace_catch","sp_finally_brace","sp_brace_finally","sp_try_brace","sp_getset_brace","sp_before_dc","sp_after_dc","sp_d_array_colon","sp_not","sp_inv","sp_addr","sp_member","sp_deref","sp_sign","sp_incdec","sp_before_nl_cont","sp_after_oc_scope","sp_after_oc_colon","sp_before_oc_colon","sp_after_oc_dict_colon","sp_before_oc_dict_colon","sp_after_send_oc_colon","sp_before_send_oc_colon","sp_after_oc_type","sp_after_oc_return_type","sp_after_oc_at_sel","sp_after_oc_at_sel_parens","sp_inside_oc_at_sel_parens","sp_before_oc_block_caret","sp_after_oc_block_caret","sp_after_oc_msg_receiver","sp_after_oc_property","sp_cond_colon","sp_cond_question","sp_case_label","sp_range","sp_after_for_colon","sp_before_for_colon","sp_extern_paren","sp_cmt_cpp_start","sp_endif_cmt","sp_after_new","sp_before_tr_emb_cmt","sp_num_before_tr_emb_cmt","sp_annotation_paren","align_keep_tabs","align_with_tabs","align_on_tabstop","align_number_left","align_func_params","align_same_func_call_params","align_var_def_span","align_var_def_star_style","align_var_def_amp_style","align_var_def_thresh","align_var_def_gap","align_var_def_colon","align_var_def_attribute","align_var_def_inline","align_assign_span","align_assign_thresh","align_enum_equ_span","align_enum_equ_thresh","align_var_struct_span","align_var_struct_thresh","align_var_struct_gap","align_struct_init_span","align_typedef_gap","align_typedef_span","align_typedef_func","align_typedef_star_style","align_typedef_amp_style","align_right_cmt_span","align_right_cmt_mix","align_right_cmt_gap","align_right_cmt_at_col","align_func_proto_span","align_func_proto_gap","align_on_operator","align_mix_var_proto","align_single_line_func","align_single_line_brace","align_single_line_brace_gap","align_oc_msg_spec_span","align_nl_cont","align_pp_define_together","align_pp_define_gap","align_pp_define_span","align_left_shift","align_oc_msg_colon_span","align_oc_msg_colon_first","align_oc_decl_colon","nl_collapse_empty_body","nl_assign_leave_one_liners","nl_class_leave_one_liners","nl_enum_leave_one_liners","nl_getset_leave_one_liners","nl_func_leave_one_liners","nl_if_leave_one_liners","nl_oc_msg_leave_one_liner","nl_start_of_file","nl_start_of_file_min","nl_end_of_file","nl_end_of_file_min","nl_assign_brace","nl_assign_square","nl_after_square_assign","nl_func_var_def_blk","nl_typedef_blk_start","nl_typedef_blk_end","nl_typedef_blk_in","nl_var_def_blk_start","nl_var_def_blk_end","nl_var_def_blk_in","nl_fcall_brace","nl_enum_brace","nl_struct_brace","nl_union_brace","nl_if_brace","nl_brace_else","nl_elseif_brace","nl_else_brace","nl_else_if","nl_brace_finally","nl_finally_brace","nl_try_brace","nl_getset_brace","nl_for_brace","nl_catch_brace","nl_brace_catch","nl_while_brace","nl_scope_brace","nl_unittest_brace","nl_version_brace","nl_using_brace","nl_brace_brace","nl_do_brace","nl_brace_while","nl_switch_brace","nl_multi_line_cond","nl_multi_line_define","nl_before_case","nl_before_throw","nl_after_case","nl_case_colon_brace","nl_namespace_brace","nl_template_class","nl_class_brace","nl_class_init_args","nl_func_type_name","nl_func_type_name_class","nl_func_scope_name","nl_func_proto_type_name","nl_func_paren","nl_func_def_paren","nl_func_decl_start","nl_func_def_start","nl_func_decl_start_single","nl_func_def_start_single","nl_func_decl_args","nl_func_def_args","nl_func_decl_end","nl_func_def_end","nl_func_decl_end_single","nl_func_def_end_single","nl_func_decl_empty","nl_func_def_empty","nl_oc_msg_args","nl_fdef_brace","nl_return_expr","nl_after_semicolon","nl_after_brace_open","nl_after_brace_open_cmt","nl_after_vbrace_open","nl_after_vbrace_open_empty","nl_after_brace_close","nl_after_vbrace_close","nl_brace_struct_var","nl_define_macro","nl_squeeze_ifdef","nl_before_if","nl_after_if","nl_before_for","nl_after_for","nl_before_while","nl_after_while","nl_before_switch","nl_after_switch","nl_before_do","nl_after_do","nl_ds_struct_enum_cmt","nl_ds_struct_enum_close_brace","nl_class_colon","nl_create_if_one_liner","nl_create_for_one_liner","nl_create_while_one_liner","pos_arith","pos_assign","pos_bool","pos_compare","pos_conditional","pos_comma","pos_class_comma","pos_class_colon","code_width","ls_for_split_full","ls_func_split_full","ls_code_width","nl_max","nl_after_func_proto","nl_after_func_proto_group","nl_after_func_body","nl_after_func_body_class","nl_after_func_body_one_liner","nl_before_block_comment","nl_before_c_comment","nl_before_cpp_comment","nl_after_multiline_comment","nl_after_struct","nl_after_class","nl_before_access_spec","nl_after_access_spec","nl_comment_func_def","nl_after_try_catch_finally","nl_around_cs_property","nl_between_get_set","nl_property_brace","eat_blanks_after_open_brace","eat_blanks_before_close_brace","nl_remove_extra_newlines","nl_before_return","nl_after_return","nl_after_annotation","nl_between_annotation","mod_full_brace_do","mod_full_brace_for","mod_full_brace_function","mod_full_brace_if","mod_full_brace_if_chain","mod_full_brace_nl","mod_full_brace_while","mod_full_brace_using","mod_paren_on_return","mod_pawn_semicolon","mod_full_paren_if_bool","mod_remove_extra_semicolon","mod_add_long_function_closebrace_comment","mod_add_long_switch_closebrace_comment","mod_add_long_ifdef_endif_comment","mod_add_long_ifdef_else_comment","mod_sort_import","mod_sort_using","mod_sort_include","mod_move_case_break","mod_case_brace","mod_remove_empty_return","cmt_width","cmt_reflow_mode","cmt_indent_multi","cmt_c_group","cmt_c_nl_start","cmt_c_nl_end","cmt_cpp_group","cmt_cpp_nl_start","cmt_cpp_nl_end","cmt_cpp_to_c","cmt_star_cont","cmt_sp_before_star_cont","cmt_sp_after_star_cont","cmt_multi_check_last","cmt_insert_file_header","cmt_insert_file_footer","cmt_insert_func_header","cmt_insert_class_header","cmt_insert_oc_msg_header","cmt_insert_before_preproc","pp_indent","pp_indent_at_level","pp_indent_count","pp_space","pp_space_count","pp_indent_region","pp_region_indent_code","pp_indent_if","pp_if_indent_code","pp_define_at_level"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters