Create a Drush command to generate barcodes

Created on 27 August 2024, 3 months ago
Updated 11 September 2024, 2 months ago

Some may ask "Why?", but I say "Why not?"

✨ Feature request
Status

Fixed

Version

2.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @tr
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    This is what it looks like. Please try it out!

    $ drush help barcodes:generate
    Generates a barcode with the given options.
    
    Examples:
     drush barcodes:generate "Hello World!"                                                Returns markup.                 
     drush barcodes:generate 0xABADCAFE --type=ean13 --height=250 --width=250 --format=png Returns markup.                 
     drush barcodes:generate "Hello World!" --format=png --binary                          Returns binary data for piping. 
    
    Arguments:
     value The string that should be formatted as a barcode. 
    
    Options:
     --type[=TYPE]                     The barcode type. [default: QRCODE]                                                      
     --color[=COLOR]                   The barcode color. [default: #000000]                                                    
     --height[=HEIGHT]                 The barcode height in pixels. [default: 100]                                             
     --width[=WIDTH]                   The barcode width in pixels. [default: 100]                                              
     --padding_top[=PADDING_TOP]       The barcode top padding in pixels.                                                       
     --padding_right[=PADDING_RIGHT]   The barcode right padding in pixels.                                                     
     --padding_bottom[=PADDING_BOTTOM] The barcode bottom padding in pixels.                                                    
     --padding_left[=PADDING_LEFT]     The barcode left padding in pixels.                                                      
     --format[=FORMAT]                 The barcode format. One of: 'svg', 'png', 'htmldiv', 'unicode', 'binary'. [default: png] 
     --binary                          Sends a binary image file to STDOUT (works with --format=png only).                      
    
    Global options:
    -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 
    -y, --yes            Auto-accept the default for all user prompts. Equivalent to --no-interaction.                      
    -l, --uri=URI        A base URL for building links and selecting a multi-site. Defaults to https://default.             
                         To see all global options, run `drush topic` and pick the first choice.                            
    
    Aliases: generate-barcode
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    And just for fun, let's add a test.

  • Status changed to Needs review 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia

    And while I'm at it, a second command (with test):

    $ drush help barcodes:formats
    Lists the formats that the Barcodes module can output.
    
    Examples:
     drush barcodes:formats                                   A table of formats showing short name (abbreviation) and description. 
     drush barcodes:formats --format=json --fields=short-name Available short names, in JSON format.                                
    
    Options:
     --format=FORMAT Format the result data. Available formats: csv,json,list,null,php,print-r,sections,string,table,tsv,var_dump,var_export,xml,yaml [default: 
                     table]                                                                                                                                     
     --fields=FIELDS Available fields: Abbreviation (short-name), Description (description) [default: short-name description]                                   
     --field=FIELD   Select just one field, and force format to *string*.                                                                                       
    
    Global options:
    -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug 
    -y, --yes            Auto-accept the default for all user prompts. Equivalent to --no-interaction.                      
    -l, --uri=URI        A base URL for building links and selecting a multi-site. Defaults to https://default.             
                         To see all global options, run `drush topic` and pick the first choice.                            
    
    Topics:
     drush topic docs:output-formats-filters Output formatters and filters: control the command output 
    
    Aliases: barcodes-formats
  • Pipeline finished with Skipped
    3 months ago
    #267593
    • TR β†’ committed 034f0f20 on 2.1.x
      Issue #3470589 by TR: Create a Drush command to generate barcodes
      
  • Status changed to Fixed 3 months ago
  • πŸ‡ΊπŸ‡ΈUnited States tr Cascadia
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024